diff options
author | Eric Wong <e@yhbt.net> | 2020-06-29 10:34:20 +0000 |
---|---|---|
committer | Eric Wong <e@yhbt.net> | 2020-06-30 03:05:29 +0000 |
commit | 761baa2a300e426885675a01e4773193ab7101ff (patch) | |
tree | 2dc5ddff8959adb2b09060bb415fc4ede789cdd8 /lib/PublicInbox/SpawnPP.pm | |
parent | 38c87c5d556e218abe59d874f0ad7968d17a79b8 (diff) | |
download | public-inbox-761baa2a300e426885675a01e4773193ab7101ff.tar.gz |
Subprocess we spawn may want to use SIGCHLD for themselves. This also ensures we restore default signal handlers in the pure Perl version.
Diffstat (limited to 'lib/PublicInbox/SpawnPP.pm')
-rw-r--r-- | lib/PublicInbox/SpawnPP.pm | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/PublicInbox/SpawnPP.pm b/lib/PublicInbox/SpawnPP.pm index 34ce2052..a72d5a2d 100644 --- a/lib/PublicInbox/SpawnPP.pm +++ b/lib/PublicInbox/SpawnPP.pm @@ -36,6 +36,11 @@ sub pi_fork_exec ($$$$$$) { if ($cd ne '') { chdir $cd or die "chdir $cd: $!"; } + $SIG{$_} = 'DEFAULT' for keys %SIG; + my $cset = POSIX::SigSet->new(); + $cset->addset(POSIX::SIGCHLD) or die "can't add SIGCHLD: $!"; + sigprocmask(SIG_UNBLOCK, $cset) or + die "can't unblock SIGCHLD: $!"; if ($ENV{MOD_PERL}) { exec which('env'), '-i', @$env, @$cmd; die "exec env -i ... $cmd->[0] failed: $!\n"; |