kraih/mojo — Issue #271: Mojolicious::Lite provides no shutdown hooks
Author: jjYBdx4IL
Created: 2012-01-26 16:19:18+00:00
State: open

Would be great to have such a feature.

Appending already registered INT/TERM/QUIT signal callback functions instead of just "overwriting" them would be ok, too.

--- /opt/perl-5.14.2/lib/site_perl/5.14.2/Mojo/Server/Daemon.pm	2011-12-23 03:46:01.000000000 +0100
+++ ../Mojo/Server/Daemon.pm	2012-01-26 17:17:15.385124609 +0100
@@ -68,7 +68,9 @@
$self->setuidgid;

# Signals
- $SIG{INT} = $SIG{TERM} = sub { exit 0 };
+ if(!defined($SIG{INT}) && !defined($SIG{TERM})) {
+ $SIG{INT} = $SIG{TERM} = sub { exit 0 };
+ }

# Start loop
$self->ioloop->start;