mirror of
https://github.com/matrix-construct/construct
synced 2024-12-25 23:14:13 +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,9 +193,30 @@ ircd::exec::signal(const int &sig)
|
|||
};
|
||||
|
||||
if(kill)
|
||||
{
|
||||
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
|
||||
|
|
Loading…
Reference in a new issue