0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-12-26 23:44:01 +01:00

ircd::exec: Additional signals; exception handling.

This commit is contained in:
Jason Volk 2020-10-20 17:42:21 -07:00
parent 86a8509b26
commit 7c931b880e

View file

@ -89,7 +89,7 @@ noexcept try
if(opt->detach) if(opt->detach)
return; return;
join(SIGKILL); join(SIGTERM);
} }
catch(const std::exception &e) catch(const std::exception &e)
{ {
@ -172,6 +172,7 @@ catch(const std::exception &e)
bool bool
ircd::exec::signal(const int &sig) ircd::exec::signal(const int &sig)
try
{ {
if(!child) if(!child)
return false; return false;
@ -192,9 +193,30 @@ ircd::exec::signal(const int &sig)
}; };
if(kill) if(kill)
{
child->terminate(); child->terminate();
return true; return true;
}
#if defined(HAVE_SIGNAL_H)
syscall(::kill, pid, sig);
return true;
#else
return false;
#endif
}
catch(const std::system_error &e)
{
log::error
{
log, "id:%lu pid:%ld `%s' signal :%s",
id,
pid,
path,
e.what(),
};
return false;
} }
size_t size_t