Branch Coverage

blib/lib/IPC/Run.pm
Criterion Covered Total %
branch 505 870 58.0


line true false branch
1058 0 121 if ($] < "5.008")
1069 0 121 if (&Win32_MODE()) { }
1070 0 0 unless eval "use IPC::Run::Win32Helper; 1;" or $@ and die
1075 0 121 unless eval "use File::Basename; 1;"
1126 0 2087 unless defined $IPC::Run::cur_self
1128 0 2087 if (&_debugging() and not defined $IPC::Run::cur_self->{'DEBUG_FD'})
1133 0 0 if &_debugging_details()
1137 2087 0 unless defined $IPC::Run::cur_self->{'DEBUG_FD'}
1147 0 1560 if defined $self->{'DEBUG_FD'}
1164 1191 159 if ("File::Spec"->file_name_is_absolute($cmd_name) and -x $cmd_name)
1165 0 1191 if &_debugging_details()
1170 0 154 $^O =~ /VMS/ ? :
0 154 $^O =~ /MacOS/ ? :
5 154 &Win32_MODE() ? :
1177 5 0 if (&Win32_MODE() and $cmd_name =~ /$dirsep/ and not $cmd_name =~ m[\.[^\\/\.]+$])
1181 0 5 if &_debugging()
1184 5 7 if -f $name and -x _
1186 0 5 if &_debugging()
1189 6 153 if ($cmd_name =~ /($dirsep)/)
1190 0 6 if &_debugging()
1191 1 5 unless -e $cmd_name
1192 0 5 unless -f $cmd_name
1193 0 5 unless -x $cmd_name
1197 92 61 if (exists $cmd_cache{$cmd_name})
1198 0 92 if &_debugging()
1200 92 0 if -x $cmd_cache{$cmd_name}
1201 0 0 if &_debugging()
1211 0 61 &Win32_MODE() ? :
1215 0 480 unless length $_
1223 0 480 &Win32_MODE() && !(-f $prospect && -x _) ? :
1227 60 420 if (-f $found and -x _)
1234 60 1 if (exists $cmd_cache{$cmd_name})
1235 0 60 if &_debugging_details()
1247 0 0 unless (defined $operand)
1252 0 0 if (not $ref) { }
0 0 elsif ($ref eq 'ARRAY') { }
0 0 elsif (UNIVERSAL::isa($operand, 'IPC::Run::Win32Process')) { }
1253 0 0 length $operand < 50 ? :
1259 0 0 /[^\w.-]/ ? :
1274 0 7128 unless defined $_[0]
1275 7128 0 $_[0] =~ /^\d+$/ ? :
1276 0 7128 if (&Win32_MODE())
1298 0 0 if (not defined $nul_fd) { }
1299 0 0 if &_debugging_details()
1303 0 0 if &_debugging_details() and not defined $r
1306 0 0 if &_debugging_details() and not defined $r
1311 7109 19 $r ? :
1313 0 7128 if &_debugging_details()
1317 0 1287 unless defined $_[0]
1319 0 1287 unless defined $r
1320 0 1287 if $r eq "0 but true"
1321 0 1287 if &_debugging_details()
1327 0 200 unless defined $_[0] and defined $_[1]
1329 0 200 unless defined $r
1330 66 134 if $r eq "0 but true"
1331 0 200 if &_debugging_details()
1337 0 95 if grep((!defined($_)), @_)
1340 0 95 if &_debugging_details()
1363 0 228 unless defined $_[0] and defined $_[1]
1364 0 228 if &_debugging_details()
1372 19 209 unless defined $r
1373 0 209 if &_debugging_data()
1384 0 2893 unless defined $r
1385 0 2893 if &_debugging_details()
1397 0 640 unless defined $f
1399 0 640 if &_debugging_details()
1400 640 0 unless (&Win32_MODE())
1404 0 640 unless $fres
1405 0 640 if &_debugging_details()
1408 0 640 if &_debugging_details()
1415 0 14 unless $pty
1417 0 14 unless $pty->blocking(0)
1418 0 14 if &_debugging_details()
1425 0 3885 unless defined $_[0]
1428 6 0 unless $r or $!{'EINTR'}
1430 0 3879 if &_debugging_data()
1440 0 1435 if UNIVERSAL::isa($kid->{'VAL'}, "IPC::Run::Win32Process")
1442 0 1435 if &_debugging_details()
1446 0 1435 unless defined $kid->{'PID'}
1448 97 1338 unless ($kid->{'PID'})
1453 0 1338 if &_debugging_details()
1460 1 1337 if (not defined $sync_pulse or length $sync_pulse)
1461 1 0 if (waitpid($kid->{'PID'}, 0) >= 0) { }
1467 0 1 unless length $sync_pulse
1475 0 0 if (keys %{$$self{"PTYS"};} and $IO::Pty::VERSION < "0.9")
1482 0 394 unless defined $_[0] and defined $_[1]
1484 0 394 unless $r
1485 0 394 if &_debugging_data()
1524 1 1220 if ($@)
1584 0 15 unless @_
1586 0 15 if @_ > 1
1589 0 15 unless defined $signal
1591 0 15 if &_debugging()
1594 0 15 unless kill $signal, $_->{'PID'}
1647 8 1 unless defined $grace
1651 9 0 unless defined $coup_d_grace
1654 0 9 if keys %options
1658 0 9 if (&Win32_MODE()) { }
1679 9 8 unless $self->_running_kids
1681 1 7 if ($accum_delay >= $grace * "0.8")
1683 1 0 if (time >= $quitting_time)
1684 1 0 unless ($have_killed_before)
1697 2 5 if $delay >= "0.5"
1736 0 1694 if (@_ and ref $_[-1] eq "HASH")
1746 93 1601 if (@_ == 1 and not ref $_[0]) { }
89 1512 elsif (@_ > 1 and not grep(ref($_), @_)) { }
1747 0 93 if (&Win32_MODE()) { }
1759 2 7459 !defined($_) ? :
1784 0 1694 if ($options)
1788 0 1694 if &_debugging()
1797 0 5359 if &_debugging()
1800 1608 4914 if (ref $_ eq 'ARRAY' or UNIVERSAL::isa($_, 'IPC::Run::Win32Process') or not $cur_kid and ref $_ eq 'CODE') { }
2 4912 elsif (UNIVERSAL::isa($_, 'IPC::Run::IO')) { }
14 4898 elsif (UNIVERSAL::isa($_, 'IPC::Run::Timer')) { }
59 4839 elsif (/^(\d*)>&(\d+)$/) { }
28 4811 elsif (/^(\d*)<&(\d+)$/) { }
34 4777 elsif (/^(\d*)<&-$/) { }
815 3962 elsif (/^(\d*) (
1727 2235 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 2217 elsif ($_ eq '|') { }
16 2201 elsif ($_ eq '&') { }
38 2163 elsif ($_ eq 'init') { }
1000 1163 elsif (not ref $_) { }
0 1163 elsif ($_ eq 'init') { }
1163 0 elsif ($succinct and $first_parse) { }
1803 0 1608 if $cur_kid
1804 0 1608 if &Win32_MODE() and ref $_ eq "CODE"
1815 9 1599 if $next_kid_close_stdin
1838 7 52 unless $cur_kid
1839 52 0 length $1 ? :
1844 0 52 if &_debugging_details()
1849 7 21 unless $cur_kid
1850 21 0 length $1 ? :
1859 14 20 unless $cur_kid
1860 20 0 length $1 ? :
1870 14 801 unless $cur_kid
1876 523 278 length $1 ? :
1879 7 794 if ($type eq "
1880 0 7 length $3 ? :
1893 749 52 unless (length $source)
1894 277 472 unless ($succinct)
1897 42 13 if (UNIVERSAL::isa($args[0], 'IPC::Run::binmode_pseudo_filter')) { }
1906 0 749 if &_empty($source)
1909 0 749 if &_debugging_details() and @filters
1916 56 745 if (ref $source eq 'GLOB' || UNIVERSAL::isa($source, 'IO::Handle') and not $type =~ /^
1918 0 56 if &_debugging_details()
1920 0 56 if &Win32_MODE()
1936 21 1706 unless $cur_kid
1940 9 1644 $2 eq '>pty' || $3 eq '>pty' ? :
53 1653 $2 eq '>pipe' || $3 eq '>pipe' ? :
1945 1008 698 length $1 ? :
1947 0 9 length $4 ? :
9 1697 $2 eq '>pty' || $3 eq '>pty' ? :
1963 1539 167 unless (length $dest)
1964 848 691 unless ($succinct)
1968 49 17 if (UNIVERSAL::isa($args[0], 'IPC::Run::binmode_pseudo_filter')) { }
1977 2 1537 if (@args and ref $args[0] eq 'IPC::Run::Undef') { }
1987 0 1539 if &_debugging_details() and @filters
1991 9 1530 if ($type eq ">pty>")
2000 0 1706 if &_empty($dest)
2004 54 1652 if (UNIVERSAL::isa($dest, 'GLOB') || UNIVERSAL::isa($dest, 'IO::Handle') and not $type =~ /^>(pty>|pipe)$/)
2006 0 54 if &_debugging_details()
2010 29 1677 if $stderr_too
2018 7 11 unless $cur_kid
2029 7 9 unless $cur_kid
2037 0 38 unless $cur_kid
2049 0 0 unless $cur_kid
2060 472 691 if (not $assumed_fd) { }
2066 0 1163 if &_debugging_details()
2073 0 0 ref $_ ? :
2082 77 5282 if ($@)
2084 0 77 if &_debugging()
2089 77 1617 if @errs
2113 0 14 if &_debugging_details()
2120 0 2 if ($@) { }
2122 0 0 if &_debugging()
2132 1345 148 if (ref $kid->{'VAL'} eq "ARRAY")
2135 11 1480 if (defined $pipe_read_fd)
2136 0 11 if &_debugging_details()
2150 746 1909 if ($op->{'TYPE'} eq '<') { }
28 1881 elsif ($op->{'TYPE'} eq '
7 1874 elsif ($op->{'TYPE'} eq '
1627 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 '&') { }
2152 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')) { }
2155 0 71 if &_debugging_details()
2158 7 64 if $self->{'_simulate_open_failure'}
2164 0 56 unless defined fileno $source
2170 0 56 if &_debugging_details()
2175 0 544 if &_debugging_details()
2185 0 68 if &_debugging_details()
2201 0 28 if &_debugging_details()
2206 0 28 if &_debugging_details()
2214 0 7 if &_debugging_details()
2218 7 0 if (UNIVERSAL::isa($source, 'SCALAR')) { }
0 0 elsif (UNIVERSAL::isa($source, 'CODE')) { }
2221 0 7 if &_debugging_details()
2230 0 0 if &_debugging_details()
2246 171 1456 if (not ref $dest) { }
54 1402 elsif (UNIVERSAL::isa($dest, 'GLOB')) { }
1297 105 elsif (UNIVERSAL::isa($dest, 'SCALAR')) { }
98 7 elsif (UNIVERSAL::isa($dest, 'CODE')) { }
2250 0 0 $op->{'TRUNC'} ? :
0 171 if &_debugging_details()
2254 7 164 if $self->{'_simulate_open_failure'}
2257 130 34 $op->{'TRUNC'} ? :
2259 0 164 if (&Win32_MODE())
2268 0 54 unless defined fileno $dest
2275 0 54 if &_debugging_details()
2278 0 1297 if &_debugging_details()
2282 1297 0 if $op->{'TRUNC'}
2285 0 98 if &_debugging_details()
2302 0 52 if &_debugging_details()
2307 0 52 if &_debugging_details()
2317 9 0 if (UNIVERSAL::isa($dest, 'SCALAR')) { }
0 0 elsif (UNIVERSAL::isa($dest, 'CODE')) { }
2320 0 9 if &_debugging_details()
2323 9 0 if $op->{'TRUNC'}
2328 0 0 if &_debugging_details()
2341 0 11 if &_debugging_details()
2343 0 11 if (&Win32_MODE())
2354 47 2608 unless ($ok)
2356 0 47 if &_debugging()
2361 47 1426 if (@errs)
2367 0 0 unless $self->{'PTYS'}{$_}
2389 20 40 unless defined $_
2393 0 40 if &_debugging_details()
2410 2063 566 if (defined $_->{'FD'})
2414 0 2063 if &_debugging_details()
2415 619 1444 $_->{'TYPE'} =~ /^
2425 1 1 if $io->mode =~ /r/
2426 1 1 if $io->mode =~ /w/
2437 1445 620 if ($pipe->{'TYPE'} =~ /^>/) { }
2441 0 2547 unless defined $pipe->{'FD'}
2442 0 2547 unless vec $self->{'ROUT'}, $pipe->{'FD'}, 1
2446 0 2547 if &_debugging_details()
2448 6 2541 if ($@)
2453 0 0 unless $@ =~ /$IPC::Run::_EIO/ or $@ =~ /input or output/ and $^O =~ /aix/ or &Win32_MODE() and $@ =~ /Bad file descriptor/
2459 1273 1274 unless (length $in)
2477 0 1870 unless defined $pipe->{'FD'}
2480 0 982 unless vec $self->{'WOUT'}, $pipe->{'FD'}, 1 or $pipe->{'PAUSED'}
2484 1870 0 unless (length $$in_ref)
2485 531 1339 unless (defined &get_more_input())
2491 939 400 unless (length $$in_ref)
2492 67 872 unless ($pipe->{'PAUSED'})
2493 0 67 if &_debugging_details()
2502 0 400 if &_debugging_details()
2504 394 6 if (length $$in_ref and $$in_ref) { }
2529 43 509 unless defined $_->{'TFD'}
2530 5 504 if $_->{'TFD'} == $fd2
2532 0 200 if (defined $self->{'DEBUG_FD'} and $self->{'DEBUG_FD'} == $fd2)
2557 0 4 unless POSIX::setsid()
2558 0 4 if &_debugging_details()
2570 0 97 if ($] < "5.008")
2584 0 97 if (&_debugging())
2588 0 0 ref $kid->{'VAL'} eq 'CODE' ? :
2596 61 36 unless ($self->{'noinherit'})
2599 0 97 if defined $self->{'DEBUG_FD'}
2610 4 93 if (%{$self->{'PTYS'};})
2613 0 4 if &_debugging_details()
2627 5 212 if ($_->{'TYPE'} =~ /^.pty.$/)
2644 0 97 if &_debugging_details()
2649 191 12 if (defined $_->{'TFD'}) { }
9 3 elsif ($_->{'TYPE'} eq 'dup') { }
2 1 elsif ($_->{'TYPE'} eq 'close') { }
1 0 elsif ($_->{'TYPE'} eq 'init') { }
2654 2 189 if ($_->{'TFD'} == $_->{'KFD'}) { }
2665 9 0 unless $_->{'KFD1'} == $_->{'KFD2'}
2670 1 1 if ($fds{$_})
2683 95 2 if (ref $kid->{'VAL'} ne "CODE")
2684 0 95 unless open $s1, ">&=$self->{'SYNC_WRITER_FD'}"
2688 0 95 if (defined $self->{'DEBUG_FD'})
2689 0 0 unless open $s2, ">&=$self->{'DEBUG_FD'}"
2694 0 95 if (&_debugging())
2696 0 0 /[\s\"]/ ? :
2700 0 95 if $self->{'_simulate_exec_failure'}
2707 0 2 if ($@)
2716 0 2 if &_debugging()
2717 0 2 if defined $self->{'DEBUG_FD'}
2787 0 1552 if (@_ and ref $_[-1] eq "HASH")
2794 23 1529 if (@_ == 1 and UNIVERSAL::isa($_[0], 'IPC::Run')) { }
2799 0 1529 $options ? :
2804 4 1471 if $self->{'STATE'} == 3
2806 0 1475 if &_debugging()
2815 0 0 if &Win32_MODE() and $IPC::Run::in_run
2822 0 18 if ($@)
2824 0 0 if &_debugging()
2829 49 1426 if ($@)
2831 0 49 if &_debugging()
2834 1426 49 unless (@errs)
2845 0 1442 if &_debugging_details()
2848 7 1435 if $self->{'_simulate_fork_failure'}
2849 0 1435 if (&Win32_MODE()) { }
2862 0 0 if $kid->{'PATH'} and &_debugging()
2871 0 0 ref $kid->{'VAL'} eq 'ARRAY' ? :
2872 0 0 if &_debugging()
2873 0 0 if ($self->{'_sleep_after_win32_spawn'})
2875 0 0 if &_debugging()
2880 8 1337 if ($@)
2882 0 8 if &_debugging()
2900 2132 105 if defined $_->{'TFD'} and not $_->{'DONT_CLOSE'} and not $closed[$_->{'TFD'}]
2901 0 2480 if ($@)
2903 0 0 if &_debugging()
2905 2132 348 if ($close_it or $@)
2911 0 2132 if ($@)
2913 0 0 if &_debugging()
2918 0 1378 unless defined $self->{'PIPES'}
2920 57 1321 if (@errs)
2922 0 57 if $@
2953 0 1844 if &_debugging_details()
2955 550 1294 $file->{'TYPE'} =~ /^
2960 11 1833 if ($file->{'TYPE'} =~ /^(.)pty.$/) { }
1833 0 elsif (UNIVERSAL::isa($file, 'IPC::Run::IO')) { }
2961 6 5 if ($1 eq ">")
2965 0 6 if &_debugging_details()
2967 6 0 if defined $self->{'PTYS'}{$file->{'PTY_ID'}}
2972 1833 0 unless $file->{'DONT_CLOSE'}
2994 204 1368 if ($io_occurred and $self->{'break_on_io'})
2995 0 204 if &_debugging_details()
3000 707 3460 $self->{'non_blocking'} ? :
3002 183 3984 if (@{$self->{'TIMERS'};})
3006 0 183 unless $_->is_running
3009 0 173 if defined $time_left and not $time_left
3010 72 101 if not defined $timeout or $time_left < $timeout
3021 6067 921 unless $file->{'PAUSED'} and $file->{'TYPE'} =~ /^
3023 0 921 if &_debugging_details()
3026 0 921 if (defined $file->{'FD'} and not defined $did or $did) { }
3027 0 0 if &_debugging_details()
3043 0 4157 if (&_debugging_details())
3048 0 0 if vec $self->{'RIN'}, $_, 1
3049 0 0 $out ? :
0 0 if vec $self->{'WIN'}, $_, 1
3050 0 0 if not $out and vec $self->{'PIN'}, $_, 1
3051 0 0 $out ? :
0 0 if vec $self->{'EIN'}, $_, 1
3052 0 0 unless $out
3057 0 0 if &_debugging_details()
3063 83 4074 unless $p
3064 3367 707 if ($p != 0 and !defined($timeout) || $timeout > 0.1)
3070 254 3113 if $not_forever >= "0.5"
3075 0 0 unless (defined $timeout or @{$self->{'PIPES'};} - $paused)
3079 0 0 if ($self->{'break_on_io'})
3080 0 0 if &_debugging()
3088 0 0 if $not_forever >= "0.5"
3091 0 0 defined $timeout ? :
0 4074 if &_debugging_details()
3095 0 4074 if (&Win32_MODE()) { }
3108 0 0 unless index(unpack("b*", $_), 1) >= 0
3119 0 0 unless defined $_
3122 700 803 if not $nfound and $self->{'non_blocking'}
3124 1 3373 if ($nfound < 0)
3125 1 0 if ($!{'EINTR'}) { }
3140 0 3374 if (&_debugging_details())
3145 0 0 if vec $self->{'ROUT'}, $_, 1
3146 0 0 $out ? :
0 0 if vec $self->{'WOUT'}, $_, 1
3147 0 0 $out ? :
0 0 if vec $self->{'EOUT'}, $_, 1
3148 0 0 unless $out
3159 1617 3371 $_->poll($self) ? :
3209 0 1374 if &_debugging_details()
3212 6 4 unless ref $_
3214 0 4 if &_debugging_data()
3217 0 4 if $@
3219 0 4 if &_debugging_data()
3222 0 4 if $@
3225 0 1374 if &_debugging_details()
3230 0 1388 if &_debugging_details()
3231 56 1332 if (not length $kid->{'PID'}) { }
0 1332 elsif (not defined $kid->{'RESULT'}) { }
3232 0 56 if &_debugging()
3236 0 82 if defined $op->{'TFD'} and not defined $op->{'TEMP_FILE_HANDLE'}
3240 0 0 if &_debugging()
3245 0 0 if &_debugging()
3256 0 1388 if &_debugging_details()
3265 2305 169 if UNIVERSAL::isa($op, "IPC::Run::IO")
3270 0 1374 if &_debugging_details()
3272 0 1374 if defined $self->{'DEBUG_FD'}
3313 0 913 unless @_ == 1 and UNIVERSAL::isa($_[0], "IPC::Run")
3320 0 913 if &_debugging()
3324 0 913 if $self->{'STATE'} < 3
3325 0 913 unless $self->pumpable
3362 0 700 if $@
3392 9615 4448 if grep((!$_->{'PAUSED'}), @{$$self{"PIPES"};})
3396 2361 2087 unless $self->_running_kids
3407 189 1898 unless $self->_running_kids
3450 0 6580 if (&Win32_MODE()) { }
3451 0 0 if not defined $kid->{'PROCESS'} or defined $kid->{'RESULT'}
3452 0 0 unless ($kid->{'PROCESS'}->Wait(0))
3453 0 0 if &_debugging_details()
3458 0 0 if &_debugging()
3462 0 0 unless $kid->{'PROCESS'}->GetExitCode($kid->{'RESULT'})
3464 0 0 if (defined $kid->{'RESULT'}) { }
3473 1258 5322 if not defined $kid->{'PID'} or defined $kid->{'RESULT'}
3475 3993 1329 unless ($pid)
3476 0 3993 if &_debugging_details()
3481 0 1329 if ($pid < 0) { }
3482 0 0 if &_debugging()
3486 0 1329 if &_debugging()
3490 0 1329 unless $pid == $kid->{'PID'}
3491 0 1329 if &_debugging()
3525 0 1309 @_ && ref $_[-1] eq 'HASH' ? :
3529 0 1309 if &_debugging()
3572 0 1308 unless $self->{'STATE'} >= 2
3573 0 1308 unless $self->{'STATE'} == 2
3584 0 0 unless $which >= 0 and $which <= $#{$$self{"KIDS"};}
3592 0 0 if (@_) { }
3597 0 0 unless @{$self->{'KIDS'};}
3599 0 0 if $_->{'RESULT'} >> 8
3652 0 1308 if (@_) { }
3657 2 1306 unless @{$self->{'KIDS'};}
3659 197 1125 if $_->{'RESULT'}
3679 0 0 unless $self->{'STATE'} >= 2
3680 0 0 unless $self->{'STATE'} == 2
3727 26 65 @_ ? :
3777 3 2 if &_empty($re)
3778 4 1 unless ref $re eq "Regexp"
3784 0 56 if length $$out_ref
3832 0 1 unless defined $suffix
3857 0 104 if (@_ > 1) { }
3869 0 0 defined $$ref ? :
3871 0 0 length $$ref ? :
3881 325 571 @$ref ? :
3884 117 208 length $s ? :
3888 0 104 ref $ref eq 'SCALAR' ? :
4135 0 2671 unless defined $IPC::Run::filter_op->{'FBUFS'}[$IPC::Run::filter_num + 1]
4136 2154 517 unless length ${$IPC::Run::filter_op->{'FBUFS'}[$IPC::Run::filter_num + 1];}
4159 0 9549 unless defined $IPC::Run::filter_op->{'FILTERS'}[$IPC::Run::filter_num]
4166 0 9549 if $@