]> git.mxchange.org Git - friendica.git/commitdiff
add shutdown handler as anonymous function
authorArt4 <art4@wlabs.de>
Sat, 28 Dec 2024 22:50:49 +0000 (22:50 +0000)
committerArt4 <art4@wlabs.de>
Sat, 28 Dec 2024 22:50:49 +0000 (22:50 +0000)
bin/jetstream.php

index 2a3b5999fabb80a8554b26865062278801dfdb6d..eae05b8580f2cb47429bdfca8605bcea8cccad29 100755 (executable)
@@ -148,7 +148,10 @@ if (!$foreground) {
        }
 
        // We now are in the child process
-       register_shutdown_function('shutdown');
+       register_shutdown_function(function (): void {
+               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) {
@@ -168,9 +171,3 @@ set_time_limit(0);
 // Now running as a daemon.
 $jetstream = $dice->create(Jetstream::class);
 $jetstream->listen();
-
-function shutdown()
-{
-       posix_kill(posix_getpid(), SIGTERM);
-       posix_kill(posix_getpid(), SIGHUP);
-}