Hello,
I am trying to use AnyEvent to handle signals (SIGHUP, SIGTERM, etc.). I think a I have to use AnyEvent since I need the process to listen to signals and filesystem events (via AnyEvent::Filesys::Notify).
According to the documentation at http://search.cpan.org/~mlehmann/AnyEvent-5.34/lib/AnyEvent.pm#SIGNAL_WATCHERS I am trying the following:
#!/usr/bin/perl use strict; use warnings; use AnyEvent; # set up event handler my $w = AnyEvent->signal (signal => "HUP", cb => sub { print "Got SIGH +UP, reloading..."; }); # wait for event $done->recv; exit 0;
Running this code on Debian Squeeze (Perl 5.10) and sending a SIGHUP to the process via kill -HUP 12345 perl just quits with the message "Hangup" spooled to STDIN.
What am I doing wrong? I would expect to see my message "Got SIGHUP, reloading..." before the exit. But the message "Hangup" makes me feel like the signal was not handled by AnyEvent but directly by perl.
Any suggestions?
Thanks.
nutris
In reply to Handle SIGHUP with AnyEvent by nutris
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |