From d8509b426d1491db9a057f90817a15e5209ff769 Mon Sep 17 00:00:00 2001 From: Art4 Date: Thu, 26 Dec 2024 09:31:36 +0000 Subject: [PATCH] Register shutdown function as anonymous function --- bin/daemon.php | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/bin/daemon.php b/bin/daemon.php index 40297b3589..d8e47e78c5 100755 --- a/bin/daemon.php +++ b/bin/daemon.php @@ -153,7 +153,10 @@ if (!$foreground) { } // 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 if (posix_setsid() < 0) { @@ -232,8 +235,3 @@ while (true) { } } })($dice, $options); - -function shutdown() { - posix_kill(posix_getpid(), SIGTERM); - posix_kill(posix_getpid(), SIGHUP); -}