New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
__WARN__ handler disabled if caught signal received in this handler #11951
Comments
From vincent@vinc17.netCreated by vincent@vinc17.netWhen a signal is received while a __WARN__ handler is being run and The perlvar(1) man page says that the __WARN__ handler is disabled The problem can be reproduced with the following script. This script $SIG{__WARN__} = sub { warn strftime("[%Y-%m-%d %T] ", gmtime).$_[0] }; probably because pending signals (e.g. SIGTERM) are received together #!/usr/bin/env perl use strict; sub wout ($) $SIG{__WARN__} = sub { wout "warn: $_[0]"; sleep 2; }; my $term = 0; sub handler $SIG{'TERM'} = \&handler; print "__WARN__ test, using perl my $pid = fork; if ($pid) __END__ One gets: $ ./warn-hook.pl Perl Info
|
From @doyI'm not sure this is really fixable - this is just how signals work. $SIG{__WARN__} = sub { $SIG{USR1} = sub { $SIG{USR2} = sub { if (my $pid = fork) { This prints: inner: outer: caught USR1 at test.pl line 14. Do you think the second warning should be "inner: outer: caught USR2" or -doy |
The RT System itself - Status changed from 'new' to 'open' |
From vincent@vinc17.netOn 2012-06-26 16:52:01 -0700, Jesse Luehrs via RT wrote:
Here this is a bit particular because of the "local". I don't think #!/usr/bin/env perl $SIG{USR1} = sub { print "$$\n"; The current behavior when the USR1 signal is received in the do block So, in your example, for USR2, sub { should be executed and give "inner: outer: caught USR2".
The global one should be restored (more generally, any local should -- |
Migrated from rt.perl.org#110292 (status was 'open')
Searchable as RT110292$
The text was updated successfully, but these errors were encountered: