Branch Coverage

blib/lib/IPC/Run.pm
Criterion Covered Total %
branch 503 848 59.3


line true false branch
1056 0 117 if ($] < 5.008)
1067 0 117 if (&Win32_MODE()) { }
1068 0 0 unless eval 'use IPC::Run::Win32Helper; 1;' or $@ and die
1073 0 117 unless eval 'use File::Basename; 1;'
1124 0 1921 unless defined $IPC::Run::cur_self
1126 0 1921 if (&_debugging() and not defined $IPC::Run::cur_self->{'DEBUG_FD'})
1131 0 0 if &_debugging_details()
1135 1921 0 unless defined $IPC::Run::cur_self->{'DEBUG_FD'}
1145 0 1374 if defined $self->{'DEBUG_FD'}
1162 1008 160 if ('File::Spec'->file_name_is_absolute($cmd_name) and -x $cmd_name)
1163 0 1008 if &_debugging_details()
1168 0 155 $^O =~ /VMS/ ? :
0 155 $^O =~ /MacOS/ ? :
5 155 &Win32_MODE() ? :
1175 5 0 if (&Win32_MODE() and $cmd_name =~ /$dirsep/ and not $cmd_name =~ m[\.[^\\/\.]+$])
1179 0 5 if &_debugging()
1182 5 7 if -f $name and -x _
1184 0 5 if &_debugging()
1187 8 152 if ($cmd_name =~ /($dirsep)/)
1188 0 8 if &_debugging()
1189 1 7 unless -e $cmd_name
1190 0 7 unless -f $cmd_name
1191 0 7 unless -x $cmd_name
1195 90 62 if (exists $cmd_cache{$cmd_name})
1196 0 90 if &_debugging()
1198 90 0 if -x $cmd_cache{$cmd_name}
1199 0 0 if &_debugging()
1209 0 62 &Win32_MODE() ? :
1213 0 468 unless length $_
1221 0 468 &Win32_MODE() && !(-f $prospect && -x _) ? :
1225 61 407 if (-f $found and -x _)
1232 61 1 if (exists $cmd_cache{$cmd_name})
1233 0 61 if &_debugging_details()
1245 0 6436 unless defined $_[0]
1246 6436 0 $_[0] =~ /^\d+$/ ? :
1248 6417 19 $r ? :
1250 0 6436 if &_debugging_details()
1254 0 1287 unless defined $_[0]
1256 0 1287 unless defined $r
1257 0 1287 if $r eq '0 but true'
1258 0 1287 if &_debugging_details()
1264 0 196 unless defined $_[0] and defined $_[1]
1266 0 196 unless defined $r
1267 66 130 if $r eq '0 but true'
1268 0 196 if &_debugging_details()
1274 0 91 if grep((!defined($_)), @_)
1277 0 91 if &_debugging_details()
1300 0 228 unless defined $_[0] and defined $_[1]
1301 0 228 if &_debugging_details()
1309 19 209 unless defined $r
1310 0 209 if &_debugging_data()
1321 0 2545 unless defined $r
1322 0 2545 if &_debugging_details()
1334 0 640 unless defined $f
1336 0 640 if &_debugging_details()
1337 640 0 unless (&Win32_MODE())
1341 0 640 unless $fres
1342 0 640 if &_debugging_details()
1345 0 640 if &_debugging_details()
1352 0 14 unless $pty
1354 0 14 unless $pty->blocking(0)
1355 0 14 if &_debugging_details()
1362 0 3383 unless defined $_[0]
1365 6 0 unless $r or $!{'EINTR'}
1367 0 3377 if &_debugging_data()
1376 0 1253 if &_debugging_details()
1380 0 1253 unless defined $kid->{'PID'}
1382 93 1160 unless ($kid->{'PID'})
1387 0 1160 if &_debugging_details()
1394 1 1159 if (not defined $sync_pulse or length $sync_pulse)
1395 1 0 if (waitpid($kid->{'PID'}, 0) >= 0) { }
1401 0 1 unless length $sync_pulse
1409 0 0 if (keys %{$$self{'PTYS'};} and $IO::Pty::VERSION < 0.9)
1416 0 394 unless defined $_[0] and defined $_[1]
1418 0 394 unless $r
1419 0 394 if &_debugging_data()
1458 1 1042 if ($@)
1518 0 15 unless @_
1520 0 15 if @_ > 1
1523 0 15 unless defined $signal
1525 0 15 if &_debugging()
1528 0 15 unless kill $signal, $_->{'PID'}
1581 8 1 unless defined $grace
1585 9 0 unless defined $coup_d_grace
1588 0 9 if keys %options
1592 0 9 if (&Win32_MODE()) { }
1613 9 8 unless $self->_running_kids
1615 1 7 if ($accum_delay >= $grace * 0.8)
1617 1 0 if (time >= $quitting_time)
1618 1 0 unless ($have_killed_before)
1631 2 5 if $delay >= 0.5
1670 0 1504 if (@_ and ref $_[-1] eq 'HASH')
1680 85 1419 if (@_ == 1 and not ref $_[0]) { }
81 1338 elsif (@_ > 1 and not grep(ref($_), @_)) { }
1681 0 85 if (&Win32_MODE()) { }
1693 2 6615 !defined($_) ? :
1718 0 1504 if ($options)
1722 0 1504 if &_debugging()
1731 0 0 ref $_ eq 'ARRAY' ? :
0 0 defined $_ ? :
0 4838 if &_debugging()
1748 1426 4575 if (ref $_ eq 'ARRAY' or not $cur_kid and ref $_ eq 'CODE') { }
2 4573 elsif (UNIVERSAL::isa($_, 'IPC::Run::IO')) { }
14 4559 elsif (UNIVERSAL::isa($_, 'IPC::Run::Timer')) { }
59 4500 elsif (/^(\d*)>&(\d+)$/) { }
28 4472 elsif (/^(\d*)<&(\d+)$/) { }
34 4438 elsif (/^(\d*)<&-$/) { }
815 3623 elsif (/^(\d*) (
1561 2062 elsif (/^() (>>?) (&) () (.*)$/x or /^() (&) (>pipe) () () $/x or /^() (>pipe)(&) () () $/x or /^(\d*)() (>pipe) () () $/x or /^() (&) (>pty) ( \w*)> () $/x or /^(\d*)() (>pty) ( \w*)> () $/x or /^() (&) (>>?) () (.*)$/x or /^(\d*)() (>>?) () (.*)$/x) { }
18 2044 elsif ($_ eq '|') { }
16 2028 elsif ($_ eq '&') { }
38 1990 elsif ($_ eq 'init') { }
827 1163 elsif (not ref $_) { }
0 1163 elsif ($_ eq 'init') { }
1163 0 elsif ($succinct and $first_parse) { }
1749 0 1426 if $cur_kid
1750 0 1426 if &Win32_MODE() and ref $_ eq 'CODE'
1761 9 1417 if $next_kid_close_stdin
1784 7 52 unless $cur_kid
1785 52 0 length $1 ? :
1790 0 52 if &_debugging_details()
1795 7 21 unless $cur_kid
1796 21 0 length $1 ? :
1805 14 20 unless $cur_kid
1806 20 0 length $1 ? :
1816 14 801 unless $cur_kid
1822 523 278 length $1 ? :
1825 7 794 if ($type eq '
1826 0 7 length $3 ? :
1839 749 52 unless (length $source)
1840 277 472 unless ($succinct)
1843 42 13 if (UNIVERSAL::isa($args[0], 'IPC::Run::binmode_pseudo_filter')) { }
1852 0 749 if &_empty($source)
1855 0 749 if &_debugging_details() and @filters
1862 56 745 if (ref $source eq 'GLOB' || UNIVERSAL::isa($source, 'IO::Handle') and not $type =~ /^
1864 0 56 if &_debugging_details()
1866 0 56 if &Win32_MODE()
1882 21 1540 unless $cur_kid
1886 9 1478 $2 eq '>pty' || $3 eq '>pty' ? :
53 1487 $2 eq '>pipe' || $3 eq '>pipe' ? :
1891 1008 532 length $1 ? :
1893 0 9 length $4 ? :
9 1531 $2 eq '>pty' || $3 eq '>pty' ? :
1909 1373 167 unless (length $dest)
1910 682 691 unless ($succinct)
1914 49 17 if (UNIVERSAL::isa($args[0], 'IPC::Run::binmode_pseudo_filter')) { }
1923 2 1371 if (@args and ref $args[0] eq 'IPC::Run::Undef') { }
1933 0 1373 if &_debugging_details() and @filters
1937 9 1364 if ($type eq '>pty>')
1946 0 1540 if &_empty($dest)
1950 54 1486 if (UNIVERSAL::isa($dest, 'GLOB') || UNIVERSAL::isa($dest, 'IO::Handle') and not $type =~ /^>(pty>|pipe)$/)
1952 0 54 if &_debugging_details()
1956 29 1511 if $stderr_too
1964 7 11 unless $cur_kid
1975 7 9 unless $cur_kid
1983 0 38 unless $cur_kid
1995 0 0 unless $cur_kid
2006 472 691 if (not $assumed_fd) { }
2012 0 1163 if &_debugging_details()
2019 0 0 ref $_ ? :
2028 77 4761 if ($@)
2030 0 77 if &_debugging()
2035 77 1427 if @errs
2059 0 14 if &_debugging_details()
2066 0 2 if ($@) { }
2068 0 0 if &_debugging()
2078 1163 148 unless (ref $kid->{'VAL'} eq 'CODE')
2081 11 1298 if (defined $pipe_read_fd)
2082 0 11 if &_debugging_details()
2096 746 1743 if ($op->{'TYPE'} eq '<') { }
28 1715 elsif ($op->{'TYPE'} eq '
7 1708 elsif ($op->{'TYPE'} eq '
1461 247 elsif ($op->{'TYPE'} eq '>') { }
52 195 elsif ($op->{'TYPE'} eq '>pipe') { }
9 186 elsif ($op->{'TYPE'} eq '>pty>') { }
11 175 elsif ($op->{'TYPE'} eq '|') { }
0 175 elsif ($op->{'TYPE'} eq '&') { }
2098 71 675 if (not ref $source) { }
56 619 elsif (UNIVERSAL::isa($source, 'GLOB') or UNIVERSAL::isa($source, 'IO::Handle')) { }
544 75 elsif (UNIVERSAL::isa($source, 'SCALAR')) { }
68 7 elsif (UNIVERSAL::isa($source, 'CODE')) { }
2101 0 71 if &_debugging_details()
2104 7 64 if $self->{'_simulate_open_failure'}
2110 0 56 unless defined fileno $source
2116 0 56 if &_debugging_details()
2121 0 544 if &_debugging_details()
2131 0 68 if &_debugging_details()
2147 0 28 if &_debugging_details()
2152 0 28 if &_debugging_details()
2160 0 7 if &_debugging_details()
2164 7 0 if (UNIVERSAL::isa($source, 'SCALAR')) { }
0 0 elsif (UNIVERSAL::isa($source, 'CODE')) { }
2167 0 7 if &_debugging_details()
2176 0 0 if &_debugging_details()
2192 171 1290 if (not ref $dest) { }
54 1236 elsif (UNIVERSAL::isa($dest, 'GLOB')) { }
1131 105 elsif (UNIVERSAL::isa($dest, 'SCALAR')) { }
98 7 elsif (UNIVERSAL::isa($dest, 'CODE')) { }
2196 0 0 $op->{'TRUNC'} ? :
0 171 if &_debugging_details()
2200 7 164 if $self->{'_simulate_open_failure'}
2203 130 34 $op->{'TRUNC'} ? :
2205 0 164 if (&Win32_MODE())
2214 0 54 unless defined fileno $dest
2221 0 54 if &_debugging_details()
2224 0 1131 if &_debugging_details()
2228 1131 0 if $op->{'TRUNC'}
2231 0 98 if &_debugging_details()
2248 0 52 if &_debugging_details()
2253 0 52 if &_debugging_details()
2263 9 0 if (UNIVERSAL::isa($dest, 'SCALAR')) { }
0 0 elsif (UNIVERSAL::isa($dest, 'CODE')) { }
2266 0 9 if &_debugging_details()
2269 9 0 if $op->{'TRUNC'}
2274 0 0 if &_debugging_details()
2287 0 11 if &_debugging_details()
2289 0 11 if (&Win32_MODE())
2300 47 2442 unless ($ok)
2302 0 47 if &_debugging()
2307 47 1244 if (@errs)
2313 0 0 unless $self->{'PTYS'}{$_}
2335 20 40 unless defined $_
2339 0 40 if &_debugging_details()
2356 1897 566 if (defined $_->{'FD'})
2360 0 1897 if &_debugging_details()
2361 619 1278 $_->{'TYPE'} =~ /^
2371 1 1 if $io->mode =~ /r/
2372 1 1 if $io->mode =~ /w/
2383 1279 620 if ($pipe->{'TYPE'} =~ /^>/) { }
2387 0 2223 unless defined $pipe->{'FD'}
2388 0 2223 unless vec $self->{'ROUT'}, $pipe->{'FD'}, 1
2392 0 2223 if &_debugging_details()
2394 6 2217 if ($@)
2399 0 0 unless $@ =~ /$IPC::Run::_EIO/ or $@ =~ /input or output/ and $^O =~ /aix/ or &Win32_MODE() and $@ =~ /Bad file descriptor/
2405 1111 1112 unless (length $in)
2423 0 1846 unless defined $pipe->{'FD'}
2426 0 962 unless vec $self->{'WOUT'}, $pipe->{'FD'}, 1 or $pipe->{'PAUSED'}
2430 1846 0 unless (length $$in_ref)
2431 531 1315 unless (defined &get_more_input())
2437 915 400 unless (length $$in_ref)
2438 63 852 unless ($pipe->{'PAUSED'})
2439 0 63 if &_debugging_details()
2448 0 400 if &_debugging_details()
2450 394 6 if (length $$in_ref and $$in_ref) { }
2475 43 505 unless defined $_->{'TFD'}
2476 5 500 if $_->{'TFD'} == $fd2
2478 0 196 if (defined $self->{'DEBUG_FD'} and $self->{'DEBUG_FD'} == $fd2)
2503 0 4 unless POSIX::setsid()
2504 0 4 if &_debugging_details()
2516 0 93 if ($] < 5.008)
2530 0 93 if (&_debugging())
2534 0 0 ref $kid->{'VAL'} eq 'CODE' ? :
2542 61 32 unless ($self->{'noinherit'})
2545 0 93 if defined $self->{'DEBUG_FD'}
2556 4 89 if (%{$self->{'PTYS'};})
2559 0 4 if &_debugging_details()
2573 5 208 if ($_->{'TYPE'} =~ /^.pty.$/)
2590 0 93 if &_debugging_details()
2595 187 12 if (defined $_->{'TFD'}) { }
9 3 elsif ($_->{'TYPE'} eq 'dup') { }
2 1 elsif ($_->{'TYPE'} eq 'close') { }
1 0 elsif ($_->{'TYPE'} eq 'init') { }
2600 2 185 if ($_->{'TFD'} == $_->{'KFD'}) { }
2611 9 0 unless $_->{'KFD1'} == $_->{'KFD2'}
2616 1 1 if ($fds{$_})
2629 91 2 if (ref $kid->{'VAL'} ne 'CODE')
2630 0 91 unless open $s1, ">&=$self->{'SYNC_WRITER_FD'}"
2634 0 91 if (defined $self->{'DEBUG_FD'})
2635 0 0 unless open $s2, ">&=$self->{'DEBUG_FD'}"
2640 0 91 if (&_debugging())
2642 0 0 /[\s\"]/ ? :
2646 0 91 if $self->{'_simulate_exec_failure'}
2653 0 2 if ($@)
2662 0 2 if &_debugging()
2663 0 2 if defined $self->{'DEBUG_FD'}
2733 0 1370 if (@_ and ref $_[-1] eq 'HASH')
2740 23 1347 if (@_ == 1 and UNIVERSAL::isa($_[0], 'IPC::Run')) { }
2745 0 1347 $options ? :
2750 4 1289 if $self->{'STATE'} == 3
2752 0 1293 if &_debugging()
2761 0 0 if &Win32_MODE() and $IPC::Run::in_run
2768 0 18 if ($@)
2770 0 0 if &_debugging()
2775 49 1244 if ($@)
2777 0 49 if &_debugging()
2780 1244 49 unless (@errs)
2795 0 0 /[^\w.-]/ ? :
0 0 ref $kid->{'VAL'} eq 'CODE' ? :
0 1260 if &_debugging_details()
2800 7 1253 if $self->{'_simulate_fork_failure'}
2801 0 1253 if (&Win32_MODE()) { }
2811 0 0 if &_debugging()
2821 0 0 if &_debugging()
2824 8 1159 if ($@)
2826 0 8 if &_debugging()
2844 1970 105 if defined $_->{'TFD'} and not $_->{'DONT_CLOSE'} and not $closed[$_->{'TFD'}]
2845 0 2318 if ($@)
2847 0 0 if &_debugging()
2849 1970 348 if ($close_it or $@)
2855 0 1970 if ($@)
2857 0 0 if &_debugging()
2862 0 1200 unless defined $self->{'PIPES'}
2864 57 1143 if (@errs)
2866 0 57 if $@
2897 0 1682 if &_debugging_details()
2899 550 1132 $file->{'TYPE'} =~ /^
2904 11 1671 if ($file->{'TYPE'} =~ /^(.)pty.$/) { }
1671 0 elsif (UNIVERSAL::isa($file, 'IPC::Run::IO')) { }
2905 6 5 if ($1 eq '>')
2909 0 6 if &_debugging_details()
2911 6 0 if defined $self->{'PTYS'}{$file->{'PTY_ID'}}
2916 1671 0 unless $file->{'DONT_CLOSE'}
2938 204 1199 if ($io_occurred and $self->{'break_on_io'})
2939 0 204 if &_debugging_details()
2944 707 3194 $self->{'non_blocking'} ? :
2946 157 3744 if (@{$self->{'TIMERS'};})
2950 0 157 unless $_->is_running
2953 0 147 if defined $time_left and not $time_left
2954 46 101 if not defined $timeout or $time_left < $timeout
2965 5806 901 unless $file->{'PAUSED'} and $file->{'TYPE'} =~ /^
2967 0 901 if &_debugging_details()
2970 0 901 if (defined $file->{'FD'} and not defined $did or $did) { }
2971 0 0 if &_debugging_details()
2987 0 3891 if (&_debugging_details())
2992 0 0 if vec $self->{'RIN'}, $_, 1
2993 0 0 $out ? :
0 0 if vec $self->{'WIN'}, $_, 1
2994 0 0 if not $out and vec $self->{'PIN'}, $_, 1
2995 0 0 $out ? :
0 0 if vec $self->{'EIN'}, $_, 1
2996 0 0 unless $out
3001 0 0 if &_debugging_details()
3007 39 3852 unless $p
3008 3145 707 if ($p != 0 and !defined($timeout) || $timeout > 0.1)
3014 246 2899 if $not_forever >= 0.5
3019 0 0 unless (defined $timeout or @{$self->{'PIPES'};} - $paused)
3023 0 0 if ($self->{'break_on_io'})
3024 0 0 if &_debugging()
3032 0 0 if $not_forever >= 0.5
3035 0 0 defined $timeout ? :
0 3852 if &_debugging_details()
3039 0 3852 if (&Win32_MODE()) { }
3052 0 0 unless index(unpack('b*', $_), '1') >= 0
3063 0 0 unless defined $_
3066 700 861 if not $nfound and $self->{'non_blocking'}
3068 1 3151 if ($nfound < 0)
3069 1 0 if ($!{'EINTR'}) { }
3084 0 3152 if (&_debugging_details())
3089 0 0 if vec $self->{'ROUT'}, $_, 1
3090 0 0 $out ? :
0 0 if vec $self->{'WOUT'}, $_, 1
3091 0 0 $out ? :
0 0 if vec $self->{'EOUT'}, $_, 1
3092 0 0 unless $out
3103 1455 3252 $_->poll($self) ? :
3153 0 1196 if &_debugging_details()
3156 6 4 unless ref $_
3158 0 4 if &_debugging_data()
3161 0 4 if $@
3163 0 4 if &_debugging_data()
3166 0 4 if $@
3169 0 1196 if &_debugging_details()
3174 0 1210 if &_debugging_details()
3175 56 1154 if (not length $kid->{'PID'}) { }
0 1154 elsif (not defined $kid->{'RESULT'}) { }
3176 0 56 if &_debugging()
3180 0 82 if defined $op->{'TFD'} and not defined $op->{'TEMP_FILE_HANDLE'}
3184 0 0 if &_debugging()
3189 0 0 if &_debugging()
3200 0 1210 if &_debugging_details()
3209 2143 169 if UNIVERSAL::isa($op, 'IPC::Run::IO')
3214 0 1196 if &_debugging_details()
3216 0 1196 if defined $self->{'DEBUG_FD'}
3257 0 913 unless @_ == 1 and UNIVERSAL::isa($_[0], 'IPC::Run')
3264 0 913 if &_debugging()
3268 0 913 if $self->{'STATE'} < 3
3269 0 913 unless $self->pumpable
3306 0 700 if $@
3336 8853 4334 if grep((!$_->{'PAUSED'}), @{$$self{'PIPES'};})
3340 2179 2155 unless $self->_running_kids
3351 88 2067 unless $self->_running_kids
3394 0 6534 if (&Win32_MODE()) { }
3395 0 0 if not defined $kid->{'PROCESS'} or defined $kid->{'RESULT'}
3396 0 0 unless ($kid->{'PROCESS'}->Wait(0))
3397 0 0 if &_debugging_details()
3402 0 0 if &_debugging()
3406 0 0 unless $kid->{'PROCESS'}->GetExitCode($kid->{'RESULT'})
3408 0 0 if (defined $kid->{'RESULT'}) { }
3417 1153 5381 if not defined $kid->{'PID'} or defined $kid->{'RESULT'}
3419 4230 1151 unless ($pid)
3420 0 4230 if &_debugging_details()
3425 0 1151 if ($pid < 0) { }
3426 0 0 if &_debugging()
3430 0 1151 if &_debugging()
3434 0 1151 unless $pid == $kid->{'PID'}
3435 0 1151 if &_debugging()
3469 0 1131 @_ && ref $_[-1] eq 'HASH' ? :
3473 0 1131 if &_debugging()
3516 0 1130 unless $self->{'STATE'} >= 2
3517 0 1130 unless $self->{'STATE'} == 2
3528 0 0 unless $which >= 0 and $which <= $#{$$self{'KIDS'};}
3536 0 0 if (@_) { }
3541 0 0 unless @{$self->{'KIDS'};}
3543 0 0 if $_->{'RESULT'} >> 8
3596 0 1130 if (@_) { }
3601 2 1128 unless @{$self->{'KIDS'};}
3603 189 955 if $_->{'RESULT'}
3623 0 0 unless $self->{'STATE'} >= 2
3624 0 0 unless $self->{'STATE'} == 2
3671 26 65 @_ ? :
3721 3 2 if &_empty($re)
3722 4 1 unless ref $re eq 'Regexp'
3728 0 56 if length $$out_ref
3776 0 1 unless defined $suffix
3801 0 96 if (@_ > 1) { }
3813 0 0 defined $$ref ? :
3815 0 0 length $$ref ? :
3825 301 527 @$ref ? :
3828 109 192 length $s ? :
3832 0 96 ref $ref eq 'SCALAR' ? :
4079 0 2479 unless defined $IPC::Run::filter_op->{'FBUFS'}[$IPC::Run::filter_num + 1]
4080 2002 477 unless length ${$IPC::Run::filter_op->{'FBUFS'}[$IPC::Run::filter_num + 1];}
4103 0 8941 unless defined $IPC::Run::filter_op->{'FILTERS'}[$IPC::Run::filter_num]
4110 0 8941 if $@