From d9bb9a1ed5143bd8dc4e829200b7608d82315201 Mon Sep 17 00:00:00 2001 From: "Kyle J. McKay" Date: Thu, 5 Nov 2015 12:38:10 -0800 Subject: [PATCH] capture_command.pl: avoid using local on %SIG Signed-off-by: Kyle J. McKay --- Girocco/extra/capture_command.pl | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Girocco/extra/capture_command.pl b/Girocco/extra/capture_command.pl index e52b98d..52e14cc 100644 --- a/Girocco/extra/capture_command.pl +++ b/Girocco/extra/capture_command.pl @@ -84,8 +84,10 @@ sub capture_command { my $new2 = ($flags & 0x02) ? fileno($pipe_out_w) : $nullfd; my $piped = 0; my $eofed = 0; - local $SIG{'CHLD'} = sub {}; - local $SIG{'PIPE'} = sub {$piped = 1}; + my $oldsigchld = $SIG{'CHLD'}; + my $oldsigpipe = $SIG{'PIPE'}; + $SIG{'CHLD'} = sub {}; + $SIG{'PIPE'} = sub {$piped = 1}; my $pid = fork(); if (defined($pid) && !$pid) { # child here @@ -165,6 +167,8 @@ sub capture_command { my $w = waitpid($pid, 0); $status = $? if $w == $pid; }} + $SIG{'CHLD'} = defined($oldsigchld) ? $oldsigchld : 'DEFAULT'; + $SIG{'PIPE'} = defined($oldsigpipe) ? $oldsigpipe : 'DEFAULT'; return ($status, $output); } -- 2.11.4.GIT