| 1 | package IPC::Open3::Utils; | ||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||
| 3 | 4 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 4 | 4 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||||||||||||||||
| 6 | 4 | $IPC::Open3::Utils::VERSION = '0.92'; | |||||||||||||||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||||||||||||||||
| 8 | 4 | require Exporter; | |||||||||||||||||||||||||||||||||||||||||
| 9 | 4 | @IPC::Open3::Utils::ISA = qw(Exporter); | |||||||||||||||||||||||||||||||||||||||||
| 10 | 4 | @IPC::Open3::Utils::EXPORT = qw(run_cmd put_cmd_in); | |||||||||||||||||||||||||||||||||||||||||
| 11 | 4 | @IPC::Open3::Utils::EXPORT_OK = qw( | |||||||||||||||||||||||||||||||||||||||||
| 12 | run_cmd put_cmd_in | ||||||||||||||||||||||||||||||||||||||||||
| 13 | child_error_ok child_error_failed_to_execute | ||||||||||||||||||||||||||||||||||||||||||
| 14 | child_error_exit_signal child_error_seg_faulted | ||||||||||||||||||||||||||||||||||||||||||
| 15 | child_error_core_dumped child_error_exit_value | ||||||||||||||||||||||||||||||||||||||||||
| 16 | create_ipc_open3_utils_wrap_script | ||||||||||||||||||||||||||||||||||||||||||
| 17 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 18 | 4 | %IPC::Open3::Utils::EXPORT_TAGS = ( | |||||||||||||||||||||||||||||||||||||||||
| 19 | 'all' => \@IPC::Open3::Utils::EXPORT_OK, | ||||||||||||||||||||||||||||||||||||||||||
| 20 | 'cmd' => [qw(run_cmd put_cmd_in)], | ||||||||||||||||||||||||||||||||||||||||||
| 21 | 'err' => [ | ||||||||||||||||||||||||||||||||||||||||||
| 22 | qw( | ||||||||||||||||||||||||||||||||||||||||||
| 23 | child_error_ok child_error_failed_to_execute | ||||||||||||||||||||||||||||||||||||||||||
| 24 | child_error_exit_signal child_error_seg_faulted | ||||||||||||||||||||||||||||||||||||||||||
| 25 | child_error_core_dumped child_error_exit_value | ||||||||||||||||||||||||||||||||||||||||||
| 26 | ) | ||||||||||||||||||||||||||||||||||||||||||
| 27 | ], | ||||||||||||||||||||||||||||||||||||||||||
| 28 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||||||||||||||||
| 30 | 4 | require IO::Select; | |||||||||||||||||||||||||||||||||||||||||
| 31 | 4 | require IPC::Open3; | |||||||||||||||||||||||||||||||||||||||||
| 32 | 4 | require IO::Handle; | |||||||||||||||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||||||||||||||||
| 34 | 35 | ▶ | sub run_cmd { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
run_cmd: called CC=73 SCAR=57.4
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 35 | 35 | my @cmd = @_; | |||||||||||||||||||||||||||||||||||||||||
| 36 | 35 | ▶ | my $arg_hr = ref $cmd[-1] eq 'HASH' ? pop(@cmd) : {}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 37 | 35 | ▶ | $arg_hr->{'ignore_handle'} ||= ''; | ||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$arg_hr->{"ignore_handle"} ||= ""
MC/DC100%1/1
$arg_hr->{"ignore_handle"} ||= ""
$arg_hr->{"ignore_handle"}
Truth table100%2/2
A
A= $arg_hr->{"ignore_handle"}
| |||||||||||||||||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||||||||||||||||
| 39 | 35 | ▶ | if ( ref $arg_hr->{'handler'} ne 'CODE' ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 40 | 0 | ▶ | $arg_hr->{'handler'} = sub { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||
| 41 | 0 | my ( $cur_line, $stdin, $is_stderr, $is_open3_err, $short_circuit_loop_sr ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 42 | 0 | ▶ | if ($is_stderr) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 43 | 0 | print STDERR $cur_line; | |||||||||||||||||||||||||||||||||||||||||
| 44 | } | ||||||||||||||||||||||||||||||||||||||||||
| 45 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 46 | 0 | print STDOUT $cur_line; | |||||||||||||||||||||||||||||||||||||||||
| 47 | } | ||||||||||||||||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||||||||||||||||
| 49 | 0 | return 1; | |||||||||||||||||||||||||||||||||||||||||
| 50 | 2 | }; | |||||||||||||||||||||||||||||||||||||||||
| 51 | } | ||||||||||||||||||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||||||||||||||||
| 53 | 35 | my $stdout = IO::Handle->new(); | |||||||||||||||||||||||||||||||||||||||||
| 54 | 35 | my $stderr = IO::Handle->new(); # TODO ? $arg_hr->{'combine_fhs'} ? $stdout : IO::Handle->new(); && then no select() | |||||||||||||||||||||||||||||||||||||||||
| 55 | 35 | my $stdin = IO::Handle->new(); | |||||||||||||||||||||||||||||||||||||||||
| 56 | 35 | my $sel = IO::Select->new(); | |||||||||||||||||||||||||||||||||||||||||
| 57 | |||||||||||||||||||||||||||||||||||||||||||
| 58 | 35 | ▶ | if ( ref $arg_hr->{'autoflush'} eq 'HASH' ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 59 | 1 | ▶ | $stdout->autoflush(1) if $arg_hr->{'autoflush'}{'stdout'}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 60 | 1 | ▶ | $stderr->autoflush(1) if $arg_hr->{'autoflush'}{'stderr'}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 61 | 1 | ▶ | $stdin->autoflush(1) if $arg_hr->{'autoflush'}{'stdin'}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 62 | } | ||||||||||||||||||||||||||||||||||||||||||
| 63 | |||||||||||||||||||||||||||||||||||||||||||
| 64 | # this is a hack to work around an exit-before-use race condition | ||||||||||||||||||||||||||||||||||||||||||
| 65 | 35 | ▶ | local $SIG{'PIPE'} = exists $SIG{'PIPE'} && defined $SIG{'PIPE'} ? $SIG{'PIPE'} : ''; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
exists $SIG{"PIPE"} and defined $SIG{"PIPE"}
MC/DC0%0/2
exists $SIG{"PIPE"} and defined $SIG{"PIPE"}
exists $SIG{"PIPE"}
defined $SIG{"PIPE"}
Truth table33%1/3
A and B
A= exists $SIG{"PIPE"}B= defined $SIG{"PIPE"}
| |||||||||||||||||||||||||||||||||||||||||||
| 66 | 35 | my $current_sig_pipe = $SIG{'PIPE'}; | |||||||||||||||||||||||||||||||||||||||||
| 67 | 35 | ▶ | if ( exists $arg_hr->{'pre_read_print_to_stdin'} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 68 | 2 | ▶ | $SIG{'PIPE'} = sub { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=5 SCAR=19.4
| |||||||||||||||||||||||||||||||||||||||||||
| 69 | |||||||||||||||||||||||||||||||||||||||||||
| 70 | # my $oserr = $!; | ||||||||||||||||||||||||||||||||||||||||||
| 71 | # my $cherr = $?; | ||||||||||||||||||||||||||||||||||||||||||
| 72 | 2 | ▶ | $stdin->close if defined $stdin && ref $stdin eq 'IO::Handle'; # && !$arg_hr->{'close_stdin'}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $stdin and ref $stdin eq "IO::Handle"
MC/DC0%0/2
defined $stdin and ref $stdin eq "IO::Handle"
defined $stdin
ref $stdin eq "IO::Handle"
Truth table33%1/3
A and B
A= defined $stdinB= ref $stdin eq "IO::Handle"
| |||||||||||||||||||||||||||||||||||||||||||
| 73 | 2 | $stdout->close; | |||||||||||||||||||||||||||||||||||||||||
| 74 | 2 | $stderr->close; | |||||||||||||||||||||||||||||||||||||||||
| 75 | |||||||||||||||||||||||||||||||||||||||||||
| 76 | # $! = $oserr; | ||||||||||||||||||||||||||||||||||||||||||
| 77 | # $? = $cherr; | ||||||||||||||||||||||||||||||||||||||||||
| 78 | 2 | ▶ | $current_sig_pipe->() if $current_sig_pipe && ref $current_sig_pipe eq 'CODE'; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$current_sig_pipe and ref $current_sig_pipe eq "CODE"
MC/DC0%0/2
$current_sig_pipe and ref $current_sig_pipe eq "CODE"
$current_sig_pipe
ref $current_sig_pipe eq "CODE"
Truth table33%1/3
A and B
A= $current_sig_pipeB= ref $current_sig_pipe eq "CODE"
| |||||||||||||||||||||||||||||||||||||||||||
| 79 | 7 | }; | |||||||||||||||||||||||||||||||||||||||||
| 80 | } | ||||||||||||||||||||||||||||||||||||||||||
| 81 | |||||||||||||||||||||||||||||||||||||||||||
| 82 | # ensure these are always re-set at the beginning of an execution | ||||||||||||||||||||||||||||||||||||||||||
| 83 | 35 | $! = 0; | |||||||||||||||||||||||||||||||||||||||||
| 84 | 35 | $? = 0; | |||||||||||||||||||||||||||||||||||||||||
| 85 | |||||||||||||||||||||||||||||||||||||||||||
| 86 | 35 | my $child_pid; | |||||||||||||||||||||||||||||||||||||||||
| 87 | 35 | eval { $child_pid = IPC::Open3::open3( $stdin, $stdout, $stderr, @cmd ) }; | |||||||||||||||||||||||||||||||||||||||||
| 88 | 35 | ▶ | if ($@) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 89 | 11 | ▶ | if ( $@ =~ m{not enough arguments} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 90 | 2 | $! = 22; # Invalid argument | |||||||||||||||||||||||||||||||||||||||||
| 91 | 2 | $? = 65280; # system();print $?; | |||||||||||||||||||||||||||||||||||||||||
| 92 | } | ||||||||||||||||||||||||||||||||||||||||||
| 93 | elsif ( $@ =~ m{open3: exec of .* failed\b} ) { | ||||||||||||||||||||||||||||||||||||||||||
| 94 | 9 | $? = -1; | |||||||||||||||||||||||||||||||||||||||||
| 95 | } | ||||||||||||||||||||||||||||||||||||||||||
| 96 | |||||||||||||||||||||||||||||||||||||||||||
| 97 | 11 | ▶ | if ( ref $arg_hr->{'open3_error'} eq 'SCALAR' ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 98 | 4 | ${ $arg_hr->{'open3_error'} } = $@; | |||||||||||||||||||||||||||||||||||||||||
| 99 | } | ||||||||||||||||||||||||||||||||||||||||||
| 100 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 101 | 7 | $arg_hr->{'open3_error'} = $@; | |||||||||||||||||||||||||||||||||||||||||
| 102 | } | ||||||||||||||||||||||||||||||||||||||||||
| 103 | |||||||||||||||||||||||||||||||||||||||||||
| 104 | 11 | ▶ | if ( $arg_hr->{'carp_open3_errors'} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 105 | 0 | require Carp; | |||||||||||||||||||||||||||||||||||||||||
| 106 | 0 | Carp::carp($@); | |||||||||||||||||||||||||||||||||||||||||
| 107 | } | ||||||||||||||||||||||||||||||||||||||||||
| 108 | |||||||||||||||||||||||||||||||||||||||||||
| 109 | 11 | return; | |||||||||||||||||||||||||||||||||||||||||
| 110 | } | ||||||||||||||||||||||||||||||||||||||||||
| 111 | |||||||||||||||||||||||||||||||||||||||||||
| 112 | 24 | ▶ | $arg_hr->{'timeout'} = exists $arg_hr->{'timeout'} ? abs( $arg_hr->{'timeout'} ) : 0; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 113 | |||||||||||||||||||||||||||||||||||||||||||
| 114 | 24 | my $alarm; | |||||||||||||||||||||||||||||||||||||||||
| 115 | my $original_alarm; | ||||||||||||||||||||||||||||||||||||||||||
| 116 | |||||||||||||||||||||||||||||||||||||||||||
| 117 | # small hack to avoid uninitialized value warnings w/ out lots of warning.pm voo-doo to | ||||||||||||||||||||||||||||||||||||||||||
| 118 | # keep the "no warnings 'uninitialized'" scoped to this assignment but the local() scoped from here on | ||||||||||||||||||||||||||||||||||||||||||
| 119 | # local $SIG{'ALRM'} = $SIG{'ALRM'};# this gives uninitialized value warnings | ||||||||||||||||||||||||||||||||||||||||||
| 120 | 24 | my $no_unit_warnings = $SIG{'ALRM'}; | |||||||||||||||||||||||||||||||||||||||||
| 121 | 24 | ▶ | local $SIG{'ALRM'} ||= ''; | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
local $SIG{"ALRM"} ||= ""
MC/DC0%0/1
local $SIG{"ALRM"} ||= ""
local $SIG{"ALRM"}
Truth table50%1/2
A
A= local $SIG{"ALRM"}
| |||||||||||||||||||||||||||||||||||||||||||
| 122 | 24 | ▶ | if ( $arg_hr->{'timeout'} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 123 | 0 | ▶ | if ( $arg_hr->{'timeout_is_microseconds'} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 124 | 0 | ▶ | if ( defined &Time::HiRes::ualarm ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 125 | 0 | $alarm = \&Time::HiRes::ualarm; | |||||||||||||||||||||||||||||||||||||||||
| 126 | } | ||||||||||||||||||||||||||||||||||||||||||
| 127 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 128 | 0 | ▶ | $alarm = defined &Time::HiRes::alarm ? \&Time::HiRes::alarm : sub { alarm( $_[0] ) }; # \&CORE::alarm, \&CORE::GLOBAL::alarm, etc don't work ... | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 129 | 0 | $arg_hr->{'timeout'} = $arg_hr->{'timeout'} / 1_000_000; | |||||||||||||||||||||||||||||||||||||||||
| 130 | 0 | ▶ | $arg_hr->{'timeout'} = 1 if $arg_hr->{'timeout'} < 1; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 131 | 0 | $arg_hr->{'timeout_is_microseconds'} = 0; | |||||||||||||||||||||||||||||||||||||||||
| 132 | } | ||||||||||||||||||||||||||||||||||||||||||
| 133 | } | ||||||||||||||||||||||||||||||||||||||||||
| 134 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 135 | 0 | ▶ | $alarm = defined &Time::HiRes::alarm ? \&Time::HiRes::alarm : sub { alarm( $_[0] ) }; # \&CORE::alarm, \&CORE::GLOBAL::alarm, etc don't work ... | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 136 | } | ||||||||||||||||||||||||||||||||||||||||||
| 137 | |||||||||||||||||||||||||||||||||||||||||||
| 138 | 0 | ▶ | $SIG{'ALRM'} = sub { die 'Alarm clock' }; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 139 | 0 | $original_alarm = $alarm->( $arg_hr->{'timeout'} ); | |||||||||||||||||||||||||||||||||||||||||
| 140 | |||||||||||||||||||||||||||||||||||||||||||
| 141 | # undocumented, for testing purposes only | ||||||||||||||||||||||||||||||||||||||||||
| 142 | 0 | ▶ | if ( exists $arg_hr->{'_timeout_info'} && ref( $arg_hr->{'_timeout_info'} ) eq 'HASH' ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
exists $arg_hr->{"_timeout_info"} and ref $arg_hr->{"_timeout_info"} eq "HASH"
MC/DC0%0/2
exists $arg_hr->{"_timeout_info"} and ref $arg_hr->{"_timeout_info"} eq "HASH"
exists $arg_hr->{"_timeout_info"}
ref $arg_hr->{"_timeout_info"} eq "HASH"
Truth table0%0/3
A and B
A= exists $arg_hr->{"_timeout_info"}B= ref $arg_hr->{"_timeout_info"} eq "HASH"
| |||||||||||||||||||||||||||||||||||||||||||
| 143 | 0 | %{ $arg_hr->{'_timeout_info'} } = ( | |||||||||||||||||||||||||||||||||||||||||
| 144 | 'timeout' => $arg_hr->{'timeout'}, | ||||||||||||||||||||||||||||||||||||||||||
| 145 | 'timeout_is_microseconds' => $arg_hr->{'timeout_is_microseconds'}, | ||||||||||||||||||||||||||||||||||||||||||
| 146 | 0 | ▶ | 'Time::Hires' => $INC{'Time/HiRes.pm'}, | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 147 | 'Time::Hires::ualarm' => defined &Time::HiRes::ualarm ? 1 : 0, | ||||||||||||||||||||||||||||||||||||||||||
| 148 | 'Time::Hires::alarm' => defined &Time::HiRes::alarm ? 1 : 0, | ||||||||||||||||||||||||||||||||||||||||||
| 149 | 'original_alarm' => $original_alarm, | ||||||||||||||||||||||||||||||||||||||||||
| 150 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 151 | } | ||||||||||||||||||||||||||||||||||||||||||
| 152 | } | ||||||||||||||||||||||||||||||||||||||||||
| 153 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 154 | 4 | ▶ | no warnings 'uninitialized'; # at least we can scopt it here ... | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 155 | 24 | $SIG{'ALRM'} = $no_unit_warnings; | |||||||||||||||||||||||||||||||||||||||||
| 156 | } | ||||||||||||||||||||||||||||||||||||||||||
| 157 | |||||||||||||||||||||||||||||||||||||||||||
| 158 | 24 | my $is_open3_err = 0; | |||||||||||||||||||||||||||||||||||||||||
| 159 | 24 | my $open3_err_is_exec = 0; | |||||||||||||||||||||||||||||||||||||||||
| 160 | 24 | my $return_bool = 1; | |||||||||||||||||||||||||||||||||||||||||
| 161 | 24 | my $short_circuit_loop = 0; | |||||||||||||||||||||||||||||||||||||||||
| 162 | |||||||||||||||||||||||||||||||||||||||||||
| 163 | 24 | eval { | |||||||||||||||||||||||||||||||||||||||||
| 164 | |||||||||||||||||||||||||||||||||||||||||||
| 165 | 24 | ▶ | if ( exists $arg_hr->{'_pre_run_sleep'} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 166 | 6 | ▶ | if ( my $sec = int( $arg_hr->{'_pre_run_sleep'} ) ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 167 | 6 | sleep $sec; # undocumented, only for testing | |||||||||||||||||||||||||||||||||||||||||
| 168 | } | ||||||||||||||||||||||||||||||||||||||||||
| 169 | } | ||||||||||||||||||||||||||||||||||||||||||
| 170 | |||||||||||||||||||||||||||||||||||||||||||
| 171 | 24 | $sel->add($stdout); # unless exists $arg_hr->{'ignore_handle'} && $arg_hr->{'ignore_handle'} eq 'stdout'; | |||||||||||||||||||||||||||||||||||||||||
| 172 | 24 | $sel->add($stderr); # unless exists $arg_hr->{'ignore_handle'} && $arg_hr->{'ignore_handle'} eq 'stderr'; | |||||||||||||||||||||||||||||||||||||||||
| 173 | |||||||||||||||||||||||||||||||||||||||||||
| 174 | 24 | ▶ | if ( exists $arg_hr->{'pre_read_print_to_stdin'} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 175 | 7 | ▶ | if ( my $type = ref( $arg_hr->{'pre_read_print_to_stdin'} ) ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 176 | 2 | ▶ | if ( $type eq 'ARRAY' ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 177 | 1 | for my $line ( @{ $arg_hr->{'pre_read_print_to_stdin'} } ) { | |||||||||||||||||||||||||||||||||||||||||
| 178 | 2 | $stdin->printflush($line); | |||||||||||||||||||||||||||||||||||||||||
| 179 | } | ||||||||||||||||||||||||||||||||||||||||||
| 180 | } | ||||||||||||||||||||||||||||||||||||||||||
| 181 | elsif ( $type eq 'CODE' ) { | ||||||||||||||||||||||||||||||||||||||||||
| 182 | 1 | for my $line ( $arg_hr->{'pre_read_print_to_stdin'}->() ) { | |||||||||||||||||||||||||||||||||||||||||
| 183 | 2 | $stdin->printflush($line); | |||||||||||||||||||||||||||||||||||||||||
| 184 | } | ||||||||||||||||||||||||||||||||||||||||||
| 185 | } | ||||||||||||||||||||||||||||||||||||||||||
| 186 | } | ||||||||||||||||||||||||||||||||||||||||||
| 187 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 188 | 5 | $stdin->printflush( $arg_hr->{'pre_read_print_to_stdin'} ); | |||||||||||||||||||||||||||||||||||||||||
| 189 | } | ||||||||||||||||||||||||||||||||||||||||||
| 190 | } | ||||||||||||||||||||||||||||||||||||||||||
| 191 | |||||||||||||||||||||||||||||||||||||||||||
| 192 | 24 | ▶ | if ( $arg_hr->{'close_stdin'} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 193 | 3 | $stdin->close(); | |||||||||||||||||||||||||||||||||||||||||
| 194 | 3 | undef $stdin; | |||||||||||||||||||||||||||||||||||||||||
| 195 | } | ||||||||||||||||||||||||||||||||||||||||||
| 196 | |||||||||||||||||||||||||||||||||||||||||||
| 197 | 24 | local *_; | |||||||||||||||||||||||||||||||||||||||||
| 198 | |||||||||||||||||||||||||||||||||||||||||||
| 199 | # to avoid "Modification of readonly value attempted" errors with @_ | ||||||||||||||||||||||||||||||||||||||||||
| 200 | # You ask, "Do you mean the _open3()'s or while()'s @_? " and the answer is: "exactly!" ;p | ||||||||||||||||||||||||||||||||||||||||||
| 201 | |||||||||||||||||||||||||||||||||||||||||||
| 202 | 24 | ▶ | my $get_next = sub { readline(shift) }; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 203 | |||||||||||||||||||||||||||||||||||||||||||
| 204 | 24 | ▶ | if ( my $byte_size = int( $arg_hr->{'read_length_bytes'} || 0 ) ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition50%1/2
$arg_hr->{'read_length_bytes'} || 0
MC/DC0%0/1
$arg_hr->{'read_length_bytes'} || 0
$arg_hr->{'read_length_bytes'}
Truth table50%1/2
A
A= $arg_hr->{'read_length_bytes'}
| |||||||||||||||||||||||||||||||||||||||||||
| 205 | 0 | my $buffer; | |||||||||||||||||||||||||||||||||||||||||
| 206 | 0 | ▶ | $byte_size = 128 if $byte_size < 128; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 207 | 0 | ▶ | $get_next = sub { shift->sysread( $buffer, $byte_size ); return $buffer; }; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 208 | } | ||||||||||||||||||||||||||||||||||||||||||
| 209 | |||||||||||||||||||||||||||||||||||||||||||
| 210 | 24 | my $odd_errno = int($!); | |||||||||||||||||||||||||||||||||||||||||
| 211 | |||||||||||||||||||||||||||||||||||||||||||
| 212 | READ_LOOP: | ||||||||||||||||||||||||||||||||||||||||||
| 213 | 24 | ▶ | while ( my @ready = $sel->can_read ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 214 | HANDLE: | ||||||||||||||||||||||||||||||||||||||||||
| 215 | 57 | for my $fh (@ready) { | |||||||||||||||||||||||||||||||||||||||||
| 216 | 78 | ▶ | if ( $fh->eof ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 217 | 39 | $sel->remove($fh); | |||||||||||||||||||||||||||||||||||||||||
| 218 | 39 | $fh->close; | |||||||||||||||||||||||||||||||||||||||||
| 219 | 39 | next HANDLE; | |||||||||||||||||||||||||||||||||||||||||
| 220 | } | ||||||||||||||||||||||||||||||||||||||||||
| 221 | |||||||||||||||||||||||||||||||||||||||||||
| 222 | 39 | ▶ | my $is_stderr = $fh eq $stderr ? 1 : 0; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 223 | |||||||||||||||||||||||||||||||||||||||||||
| 224 | CMD_OUTPUT: | ||||||||||||||||||||||||||||||||||||||||||
| 225 | 39 | ▶ | while ( my $cur_line = $get_next->($fh) ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 226 | 43 | ▶ | next CMD_OUTPUT if $arg_hr->{'ignore_handle'} eq ( $is_stderr ? 'stderr' : 'stdout' ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 227 | |||||||||||||||||||||||||||||||||||||||||||
| 228 | 41 | ▶ | $is_open3_err = 1 if $is_stderr && $cur_line =~ m{^open3:}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$is_stderr and $cur_line =~ /^open3:/
MC/DC0%0/2
$is_stderr and $cur_line =~ /^open3:/
$is_stderr
$cur_line =~ /^open3:/
Truth table66%2/3
A and B
A= $is_stderrB= $cur_line =~ /^open3:/
| |||||||||||||||||||||||||||||||||||||||||||
| 229 | 41 | ▶ | if ($is_open3_err) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 230 | 0 | ▶ | if ( ref $arg_hr->{'open3_error'} eq 'SCALAR' ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 231 | 0 | ${ $arg_hr->{'open3_error'} } = $cur_line; | |||||||||||||||||||||||||||||||||||||||||
| 232 | } | ||||||||||||||||||||||||||||||||||||||||||
| 233 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 234 | 0 | $arg_hr->{'open3_error'} = $cur_line; | |||||||||||||||||||||||||||||||||||||||||
| 235 | } | ||||||||||||||||||||||||||||||||||||||||||
| 236 | |||||||||||||||||||||||||||||||||||||||||||
| 237 | 0 | ▶ | if ( $arg_hr->{'carp_open3_errors'} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 238 | 0 | require Carp; | |||||||||||||||||||||||||||||||||||||||||
| 239 | 0 | Carp::carp($cur_line); | |||||||||||||||||||||||||||||||||||||||||
| 240 | } | ||||||||||||||||||||||||||||||||||||||||||
| 241 | |||||||||||||||||||||||||||||||||||||||||||
| 242 | 0 | ▶ | if ( $cur_line =~ m{open3: exec of .* failed\b} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 243 | 0 | $open3_err_is_exec = 1; | |||||||||||||||||||||||||||||||||||||||||
| 244 | } | ||||||||||||||||||||||||||||||||||||||||||
| 245 | } | ||||||||||||||||||||||||||||||||||||||||||
| 246 | |||||||||||||||||||||||||||||||||||||||||||
| 247 | 41 | $return_bool = $arg_hr->{'handler'}->( $cur_line, $stdin, $is_stderr, $is_open3_err, \$short_circuit_loop ); | |||||||||||||||||||||||||||||||||||||||||
| 248 | |||||||||||||||||||||||||||||||||||||||||||
| 249 | 40 | ▶ | last READ_LOOP if !$return_bool; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 250 | 39 | ▶ | last READ_LOOP if $is_open3_err && $arg_hr->{'stop_read_on_open3_err'}; # this is probably the last one anyway | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$is_open3_err and $arg_hr->{"stop_read_on_open3_err"}
MC/DC0%0/2
$is_open3_err and $arg_hr->{"stop_read_on_open3_err"}
$is_open3_err
$arg_hr->{"stop_read_on_open3_err"}
Truth table33%1/3
A and B
A= $is_open3_errB= $arg_hr->{"stop_read_on_open3_err"}
| |||||||||||||||||||||||||||||||||||||||||||
| 251 | 39 | ▶ | last READ_LOOP if $short_circuit_loop; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 252 | } | ||||||||||||||||||||||||||||||||||||||||||
| 253 | } | ||||||||||||||||||||||||||||||||||||||||||
| 254 | |||||||||||||||||||||||||||||||||||||||||||
| 255 | 54 | $odd_errno = int($!); | |||||||||||||||||||||||||||||||||||||||||
| 256 | } | ||||||||||||||||||||||||||||||||||||||||||
| 257 | |||||||||||||||||||||||||||||||||||||||||||
| 258 | 23 | ▶ | $! = 0 if $odd_errno == 0 && $! == 9; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$odd_errno == 0 and $! == 9
MC/DC0%0/2
$odd_errno == 0 and $! == 9
$odd_errno == 0
$! == 9
Truth table66%2/3
A and B
A= $odd_errno == 0B= $! == 9
| |||||||||||||||||||||||||||||||||||||||||||
| 259 | |||||||||||||||||||||||||||||||||||||||||||
| 260 | # my $oserr = $!; | ||||||||||||||||||||||||||||||||||||||||||
| 261 | # my $cherr = $?; | ||||||||||||||||||||||||||||||||||||||||||
| 262 | 23 | ▶ | $stdout->close if $stdout->opened; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 263 | 23 | ▶ | $stderr->close if $stderr->opened; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 264 | 23 | ▶ | $stdin->close if defined $stdin && ref $stdin eq 'IO::Handle' && $stdin->opened; # && !$arg_hr->{'close_stdin'}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition83%5/6
defined $stdin and ref $stdin eq "IO::Handle" and $stdin->opened
defined $stdin and ref $stdin eq "IO::Handle"
MC/DC66%2/3
defined $stdin and ref $stdin eq "IO::Handle" and $stdin->opened
defined $stdin
ref $stdin eq "IO::Handle"
$stdin->opened
Truth table75%3/4
A and B and C
A= defined $stdinB= ref $stdin eq "IO::Handle"C= $stdin->opened
| |||||||||||||||||||||||||||||||||||||||||||
| 265 | |||||||||||||||||||||||||||||||||||||||||||
| 266 | # $! = $oserr; | ||||||||||||||||||||||||||||||||||||||||||
| 267 | # $? = $cherr; | ||||||||||||||||||||||||||||||||||||||||||
| 268 | |||||||||||||||||||||||||||||||||||||||||||
| 269 | 23 | waitpid $child_pid, 0; | |||||||||||||||||||||||||||||||||||||||||
| 270 | |||||||||||||||||||||||||||||||||||||||||||
| 271 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 272 | |||||||||||||||||||||||||||||||||||||||||||
| 273 | 24 | ▶ | if ( $arg_hr->{'timeout'} && defined $original_alarm ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$arg_hr->{"timeout"} and defined $original_alarm
MC/DC0%0/2
$arg_hr->{"timeout"} and defined $original_alarm
$arg_hr->{"timeout"}
defined $original_alarm
Truth table33%1/3
A and B
A= $arg_hr->{"timeout"}B= defined $original_alarm
| |||||||||||||||||||||||||||||||||||||||||||
| 274 | 0 | $alarm->($original_alarm); | |||||||||||||||||||||||||||||||||||||||||
| 275 | } | ||||||||||||||||||||||||||||||||||||||||||
| 276 | |||||||||||||||||||||||||||||||||||||||||||
| 277 | 24 | ▶ | if ($@) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 278 | |||||||||||||||||||||||||||||||||||||||||||
| 279 | # if ($@ =~ m/^Alarm clock /) { | ||||||||||||||||||||||||||||||||||||||||||
| 280 | # $! = 60; | ||||||||||||||||||||||||||||||||||||||||||
| 281 | # # $? = ??; | ||||||||||||||||||||||||||||||||||||||||||
| 282 | # } | ||||||||||||||||||||||||||||||||||||||||||
| 283 | 1 | return; | |||||||||||||||||||||||||||||||||||||||||
| 284 | } | ||||||||||||||||||||||||||||||||||||||||||
| 285 | |||||||||||||||||||||||||||||||||||||||||||
| 286 | 23 | ▶ | if ( $is_open3_err && $open3_err_is_exec && $? != -1 ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%2/6
$is_open3_err and $open3_err_is_exec and $? != -1
$is_open3_err and $open3_err_is_exec
MC/DC0%0/3
$is_open3_err and $open3_err_is_exec and $? != -1
$is_open3_err
$open3_err_is_exec
$? != -1
Truth table25%1/4
A and B and C
A= $is_open3_errB= $open3_err_is_execC= $? != -1
| |||||||||||||||||||||||||||||||||||||||||||
| 287 | 0 | $? = -1; | |||||||||||||||||||||||||||||||||||||||||
| 288 | } | ||||||||||||||||||||||||||||||||||||||||||
| 289 | |||||||||||||||||||||||||||||||||||||||||||
| 290 | 23 | ▶ | return if $is_open3_err || !$return_bool || !child_error_ok($?); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition83%5/6
$is_open3_err or not $return_bool or not child_error_ok($?)
$is_open3_err or not $return_bool
MC/DC66%2/3
$is_open3_err or not $return_bool or not child_error_ok($?)
$is_open3_err
not $return_bool
not child_error_ok($?)
Truth table75%3/4
A or not(B) or not(C)
A= $is_open3_errB= not $return_boolC= not child_error_ok($?)
| |||||||||||||||||||||||||||||||||||||||||||
| 291 | 19 | return 1; | |||||||||||||||||||||||||||||||||||||||||
| 292 | } | ||||||||||||||||||||||||||||||||||||||||||
| 293 | |||||||||||||||||||||||||||||||||||||||||||
| 294 | 18 | ▶ | sub put_cmd_in { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
put_cmd_in: called CC=6 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 295 | 18 | my (@cmd) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 296 | |||||||||||||||||||||||||||||||||||||||||||
| 297 | 18 | ▶ | my $arg_hr = ref $cmd[-1] eq 'HASH' ? pop(@cmd) : {}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 298 | |||||||||||||||||||||||||||||||||||||||||||
| 299 | # not being this strict allows us to do "no" output ref quietness | ||||||||||||||||||||||||||||||||||||||||||
| 300 | # return if @cmd < 2; | ||||||||||||||||||||||||||||||||||||||||||
| 301 | # return if defined $cmd[-1] && !ref $cmd[-1]; | ||||||||||||||||||||||||||||||||||||||||||
| 302 | # my $err = pop(@cmd); | ||||||||||||||||||||||||||||||||||||||||||
| 303 | |||||||||||||||||||||||||||||||||||||||||||
| 304 | 18 | ▶ | my $err = !defined $cmd[-1] || ref $cmd[-1] ? pop(@cmd) : undef; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
not defined $cmd[-1] or ref $cmd[-1]
MC/DC0%0/2
not defined $cmd[-1] or ref $cmd[-1]
not defined $cmd[-1]
ref $cmd[-1]
Truth table66%2/3
not(A) or B
A= not defined $cmd[-1]B= ref $cmd[-1]
| |||||||||||||||||||||||||||||||||||||||||||
| 305 | 18 | ▶ | my $out = !defined $cmd[-1] || ref $cmd[-1] ? pop(@cmd) : $err; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
not defined $cmd[-1] or ref $cmd[-1]
MC/DC100%2/2
not defined $cmd[-1] or ref $cmd[-1]
not defined $cmd[-1]
ref $cmd[-1]
Truth table100%3/3
not(A) or B
A= not defined $cmd[-1]B= ref $cmd[-1]
| |||||||||||||||||||||||||||||||||||||||||||
| 306 | |||||||||||||||||||||||||||||||||||||||||||
| 307 | 29 | ▶ | $arg_hr->{'handler'} = sub { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=4 SCAR=13.9
| |||||||||||||||||||||||||||||||||||||||||||
| 308 | 29 | my ( $cur_line, $stdin, $is_stderr, $is_open3_err, $short_circuit_loop_sr ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 309 | |||||||||||||||||||||||||||||||||||||||||||
| 310 | 29 | ▶ | my $mod = $is_stderr ? $err : $out; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 311 | 29 | ▶ | return 1 if !defined $mod; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 312 | |||||||||||||||||||||||||||||||||||||||||||
| 313 | 27 | ▶ | if ( ref $mod eq 'SCALAR' ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 314 | 19 | ${$mod} .= $cur_line; | |||||||||||||||||||||||||||||||||||||||||
| 315 | } | ||||||||||||||||||||||||||||||||||||||||||
| 316 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 317 | 8 | push @{$mod}, $cur_line; | |||||||||||||||||||||||||||||||||||||||||
| 318 | } | ||||||||||||||||||||||||||||||||||||||||||
| 319 | |||||||||||||||||||||||||||||||||||||||||||
| 320 | 27 | return 1; | |||||||||||||||||||||||||||||||||||||||||
| 321 | 18 | }; | |||||||||||||||||||||||||||||||||||||||||
| 322 | |||||||||||||||||||||||||||||||||||||||||||
| 323 | 18 | return run_cmd( @cmd, $arg_hr ); | |||||||||||||||||||||||||||||||||||||||||
| 324 | } | ||||||||||||||||||||||||||||||||||||||||||
| 325 | |||||||||||||||||||||||||||||||||||||||||||
| 326 | ##################### | ||||||||||||||||||||||||||||||||||||||||||
| 327 | #### child_error_* ## | ||||||||||||||||||||||||||||||||||||||||||
| 328 | ##################### | ||||||||||||||||||||||||||||||||||||||||||
| 329 | |||||||||||||||||||||||||||||||||||||||||||
| 330 | 28 | ▶ | sub child_error_ok { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
child_error_ok: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 331 | 28 | ▶ | my $sysrc = @_ ? shift() : $?; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 332 | 28 | ▶ | return 1 if $sysrc == 0; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 333 | 7 | return; | |||||||||||||||||||||||||||||||||||||||||
| 334 | } | ||||||||||||||||||||||||||||||||||||||||||
| 335 | |||||||||||||||||||||||||||||||||||||||||||
| 336 | 24 | ▶ | sub child_error_failed_to_execute { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
child_error_failed_to_execute: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 337 | 24 | ▶ | my $sysrc = @_ ? shift() : $?; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 338 | 24 | return $sysrc == -1; | |||||||||||||||||||||||||||||||||||||||||
| 339 | } | ||||||||||||||||||||||||||||||||||||||||||
| 340 | |||||||||||||||||||||||||||||||||||||||||||
| 341 | 4 | ▶ | sub child_error_seg_faulted { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
child_error_seg_faulted: called CC=3 SCAR=11.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 342 | 4 | ▶ | my $sysrc = @_ ? shift() : $?; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 343 | 4 | ▶ | return if child_error_failed_to_execute($sysrc); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 344 | 4 | return child_error_exit_signal($sysrc) == 11; | |||||||||||||||||||||||||||||||||||||||||
| 345 | } | ||||||||||||||||||||||||||||||||||||||||||
| 346 | |||||||||||||||||||||||||||||||||||||||||||
| 347 | 4 | ▶ | sub child_error_core_dumped { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
child_error_core_dumped: called CC=3 SCAR=11.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 348 | 4 | ▶ | my $sysrc = @_ ? shift() : $?; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 349 | 4 | ▶ | return if child_error_failed_to_execute($sysrc); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 350 | 4 | return $sysrc & 128; | |||||||||||||||||||||||||||||||||||||||||
| 351 | } | ||||||||||||||||||||||||||||||||||||||||||
| 352 | |||||||||||||||||||||||||||||||||||||||||||
| 353 | 8 | ▶ | sub child_error_exit_signal { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
child_error_exit_signal: called CC=3 SCAR=11.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 354 | 8 | ▶ | my $sysrc = @_ ? shift() : $?; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 355 | 8 | ▶ | return if child_error_failed_to_execute($sysrc); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 356 | 8 | return $sysrc & 127; | |||||||||||||||||||||||||||||||||||||||||
| 357 | } | ||||||||||||||||||||||||||||||||||||||||||
| 358 | |||||||||||||||||||||||||||||||||||||||||||
| 359 | 4 | ▶ | sub child_error_exit_value { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
child_error_exit_value: called CC=3 SCAR=11.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 360 | 4 | ▶ | my $sysrc = @_ ? shift() : $?; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 361 | 4 | ▶ | return if child_error_failed_to_execute($sysrc); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 362 | 4 | return $sysrc >> 8; | |||||||||||||||||||||||||||||||||||||||||
| 363 | } | ||||||||||||||||||||||||||||||||||||||||||
| 364 | |||||||||||||||||||||||||||||||||||||||||||
| 365 | 4 | 1; | |||||||||||||||||||||||||||||||||||||||||
| 366 | |||||||||||||||||||||||||||||||||||||||||||
| 367 | __END__ | ||||||||||||||||||||||||||||||||||||||||||