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:
parent
86a8509b26
commit
7c931b880e
1 changed files with 24 additions and 2 deletions
26
ircd/exec.cc
26
ircd/exec.cc
|
@ -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)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue