cooperate with nohup
If SIGHUP is initially ignored, don't set a SIGHUP handler.
This commit is contained in:
parent
27c7f45937
commit
eba9be1b39
|
@ -462,6 +462,14 @@ void scheme_set_signal_handler(int sig_id, Scheme_Signal_Handler_Proc proc) XFOR
|
|||
{
|
||||
#ifndef WINDOWS_PROCESSES
|
||||
struct sigaction sa;
|
||||
|
||||
if (sig_id == SIGHUP) {
|
||||
/* cooperate with `nohup` by keeping SIHGUP as-is when ignored */
|
||||
sigaction(SIGHUP, NULL, &sa);
|
||||
if (sa.sa_handler == SIG_IGN)
|
||||
return;
|
||||
}
|
||||
|
||||
sigemptyset(&sa.sa_mask);
|
||||
sa.sa_flags = 0;
|
||||
sa.sa_handler = (proc ? proc : SIG_IGN);
|
||||
|
|
|
@ -68,7 +68,13 @@ void rktio_install_os_signal_handler(rktio_t *rktio)
|
|||
#if defined(RKTIO_SYSTEM_UNIX)
|
||||
rktio_set_signal_handler(SIGINT, user_break_hit);
|
||||
rktio_set_signal_handler(SIGTERM, term_hit);
|
||||
{
|
||||
struct sigaction sa;
|
||||
sigemptyset(&sa.sa_mask);
|
||||
sigaction(SIGHUP, NULL, &sa);
|
||||
if (sa.sa_handler != SIG_IGN)
|
||||
rktio_set_signal_handler(SIGHUP, hup_hit);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(RKTIO_SYSTEM_WINDOWS)
|
||||
|
|
Loading…
Reference in New Issue
Block a user