[Rt-commit] [svn] r1752 - in rt/branches/3.3-TESTING: . bin
autrijus at pallas.eruditorum.org
autrijus at pallas.eruditorum.org
Mon Nov 8 07:53:51 EST 2004
Author: autrijus
Date: Mon Nov 8 07:53:51 2004
New Revision: 1752
Modified:
rt/branches/3.3-TESTING/ (props changed)
rt/branches/3.3-TESTING/bin/standalone_httpd.in
Log:
r3280 at not: autrijus | 2004-11-08T12:13:28.529608Z
* make kill -HUP work sanely.
Modified: rt/branches/3.3-TESTING/bin/standalone_httpd.in
==============================================================================
--- rt/branches/3.3-TESTING/bin/standalone_httpd.in (original)
+++ rt/branches/3.3-TESTING/bin/standalone_httpd.in Mon Nov 8 07:53:51 2004
@@ -56,7 +56,24 @@
use Socket;
$SIG{CHLD} = "IGNORE"; # reap child processes
-$SIG{HUP} = sub { exec($^X, $0, @ARGV) };
+$SIG{HUP} = sub {
+ # on a "kill -HUP", we first close our socket handles.
+ close Remote;
+ close HTTPDaemon;
+
+ # and then, on systems implementing fork(), we make sure
+ # we are running with a new pid, so another -HUP will still
+ # work on the new process.
+ require Config;
+ if ($Config::Config{d_fork} and my $pid = fork()) {
+ # finally, allow ^C on the parent process to terminate
+ # the children.
+ waitpid($pid, 0); exit;
+ }
+
+ # do the exec. if $0 is not executable, try running it with $^X.
+ exec { $0 } ( ((-x $0) ? () : ($^X)), $0, @ARGV );
+};
RT::Init();
More information about the Rt-commit
mailing list