0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-12-26 15:33:54 +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)
return;
join(SIGKILL);
join(SIGTERM);
}
catch(const std::exception &e)
{
@ -172,6 +172,7 @@ catch(const std::exception &e)
bool
ircd::exec::signal(const int &sig)
try
{
if(!child)
return false;
@ -192,11 +193,32 @@ ircd::exec::signal(const int &sig)
};
if(kill)
{
child->terminate();
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
ircd::exec::write(const const_buffers &bufs)
{