mirror of
https://github.com/friendica/friendica
synced 2025-01-08 20:04:43 +00:00
Register shutdown function as anonymous function
This commit is contained in:
parent
4348b0b873
commit
d8509b426d
1 changed files with 4 additions and 6 deletions
|
@ -153,7 +153,10 @@ if (!$foreground) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// We now are in the child process
|
// We now are in the child process
|
||||||
register_shutdown_function('shutdown');
|
register_shutdown_function(function () {
|
||||||
|
posix_kill(posix_getpid(), SIGTERM);
|
||||||
|
posix_kill(posix_getpid(), SIGHUP);
|
||||||
|
});
|
||||||
|
|
||||||
// Make the child the main process, detach it from the terminal
|
// Make the child the main process, detach it from the terminal
|
||||||
if (posix_setsid() < 0) {
|
if (posix_setsid() < 0) {
|
||||||
|
@ -232,8 +235,3 @@ while (true) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})($dice, $options);
|
})($dice, $options);
|
||||||
|
|
||||||
function shutdown() {
|
|
||||||
posix_kill(posix_getpid(), SIGTERM);
|
|
||||||
posix_kill(posix_getpid(), SIGHUP);
|
|
||||||
}
|
|
||||||
|
|
Loading…
Reference in a new issue