Branch Coverage

blib/lib/IPC/Exe.pm
Criterion Covered Total %
branch 148 306 48.3


line true false branch
38 6478 1436 unless &Scalar::Util::reftype($_[0])
52 0 4 $status == -1 ? :
54 0 4 if 'threads'->can('exit')
62 0 40 NON_UNIX ? :
63 0 0 $1 eq '"' ? :
65 0 0 $x =~ /[\[\](){}<>'"`~!\@^&+=|;,\s]/ ? :
79 1 6 if tainted $v
83 1 27 if tainted($ENV{$v})
87 2 2 if (@bad_args or @bad_env)
103 20 6 $n <= 2 ? :
111 4 1167 if $] >= 5.008 and ${^TAINT}
113 45 1124 if @_ == 0
116 45 1079 if @_ == 1 and _reftype($_[0]) eq 'CODE'
119 325 735 @_ ? :
138 14 1046 if (_reftype($opt_ref) eq 'HASH')
145 0 1060 defined $opt{'binmode_io'} ? :
154 12 1048 if ($opt{'stdin'})
156 0 12 unless pipe $FOR_STDIN, $TO_STDIN
161 12 0 if $opt{'autoflush'}
166 6 1054 if ($opt{'stderr'})
168 0 6 unless pipe $FROM_STDERR, $BY_STDERR
173 6 0 if $opt{'autoflush'}
178 252 808 if _reftype($_[0]) eq 'CODE'
179 833 227 if _reftype($_[-1]) eq 'CODE'
184 291 769 if (@redirs)
187 0 291 if $Preexec
191 0 9 if $old_preexec
200 26 1034 if (grep {not defined $_;} @cmd_list)
208 0 1034 unless defined $Preexec or @cmd_list
212 0 1034 NON_UNIX ? :
0 1034 unless NON_UNIX ? open($ORIGSTDIN, '<&=STDIN') : open($ORIGSTDIN, '<&STDIN')
223 0 1034 unless ($defined_child)
230 990 44 if ($gotchild) { }
234 9 981 if $FOR_STDIN
235 4 986 if $BY_STDERR
238 0 990 if (defined $IPC::Exe::_binmode_io and index($IPC::Exe::_binmode_io, ':') == 0)
243 0 0 if ($opt{'stdin'})
245 0 0 unless binmode $TO_STDIN, $layer
250 0 0 unless binmode $EXE_READ, $layer
257 798 192 if ($Reader) { }
187 5 elsif (not $opt{'stdout'}) { }
263 5 793 $IPC::Exe::_stdin ? :
0 798 unless $IPC::Exe::_stdin ? open(*STDIN, '<&=', $EXE_READ) : open(*STDIN, '<&', $EXE_READ)
280 44 737 $failed ? :
283 0 781 NON_UNIX ? :
0 781 unless NON_UNIX ? open(*STDIN, '<&=', $ORIGSTDIN) : open(*STDIN, '<&', $ORIGSTDIN)
288 44 737 if $failed
301 920 0 unless ($IPC::Exe::_stdin or $opt{'stdout'} or $opt{'stderr'})
310 187 5 unless ($Reader or $opt{'stdout'})
319 232 697 if ($status[0] == -1 or $status[0] == 65280)
325 100 132 if not $Reader || $opt{'stdout'} and $reap == $gotchild || $reap == -1 || $reap == 0 and $ret[0] = -1 or $reap == $gotchild
333 0 127 if ($status[0] == -1 and $Reader and $reap == $gotchild and @ret)
340 3 926 if _reftype($opt{'pid'}) eq 'SCALAR'
341 0 929 if _reftype($opt{'stdin'}) eq 'SCALAR'
342 0 929 if _reftype($opt{'stdout'}) eq 'SCALAR'
343 3 926 if _reftype($opt{'stderr'}) eq 'SCALAR'
346 926 3 _reftype($opt{'pid'}) ne 'SCALAR' ? :
8 921 $opt{'stdin'} && _reftype($opt{'stdin'}) ne 'SCALAR' ? :
5 924 $opt{'stdout'} && _reftype($opt{'stdout'}) ne 'SCALAR' ? :
4 925 $opt{'stderr'} && _reftype($opt{'stderr'}) ne 'SCALAR' ? :
354 737 192 @status_reader ? :
372 3 41 if $TO_STDIN
373 2 42 if $FROM_STDERR
376 3 41 if ($FOR_STDIN)
378 0 3 unless open *STDIN, '<&=', $FOR_STDIN
383 2 42 if ($BY_STDERR)
385 0 2 unless open *STDERR, '>&=', $BY_STDERR
390 0 44 if (defined $IPC::Exe::_binmode_io and index($IPC::Exe::_binmode_io, ':') == 0)
395 0 0 unless binmode *STDIN, $layer and binmode *STDOUT, $layer
403 21 23 if ($Preexec)
406 5 16 $_args ? :
411 44 0 if _is_fh(*STDERR)
412 44 0 if _is_fh(*STDOUT)
415 4 40 unless (@cmd_list)
418 0 4 if (NON_UNIX and _is_fh($EXE_GO))
431 13 8 if (ref $_)
435 12 1 if (_reftype($_) =~ /REF|SCALAR/)
442 1 12 if (_reftype($_) eq 'ARRAY')
447 1 0 if (not $is_sysopen and defined $args[0])
451 1 0 if (defined $op)
453 0 0 index($op, '<') == -1 ? :
0 1 if $src eq ''
462 0 1 $is_sysopen ? :
1 0 $FH_name ? :
1 0 $FH_name ? :
471 0 1 $is_sysopen ? :
0 1 if $is_sysopen ? @args < 3 || @args > 4 : @args == 0
476 0 0 @args == 4 ? :
1 0 @args >= 2 ? :
0 1 @args >= 3 ? :
0 1 $is_sysopen ? :
0 1 unless $is_sysopen ? @args == 4 ? sysopen($args[0], $args[1], $args[2], $args[3]) : sysopen($args[0], $args[1], $args[2]) : open($args[0], @args >= 2 ? $args[1] : (), @args >= 3 ? $args[2] : (), @args[3 .. $#args])
493 0 20 unless defined $_
496 0 20 if (/^\s*([012])\s*(:.*)$/)
500 0 0 if $layer eq ':'
502 0 0 unless binmode +(*STDIN, *STDOUT, *STDERR)[$1], $layer
510 11 9 if (/^\s*(\d*)\s*>\s*(?:null|#)\s*$/)
512 1 10 $1 eq '' ? :
515 0 11 unless open $FH, '>', $DEVNULL
523 0 9 if (/^\s*(\d+)\s*><\s*(\d+)\s*$/)
530 0 0 unless _is_fh($FH1) and _is_fh($FH2) and open $SWAP, '>&', $FH1 and open $FH1, '>&', $FH2 and open $FH2, '>&=', $SWAP
544 8 1 if (defined $op)
546 0 0 index($op, '<') == -1 ? :
0 8 if $src eq ''
551 2 6 if ($tgt eq '-')
553 0 2 unless close $FH1
562 0 6 unless _is_fh($FH2) and open $FH1, $op, $FH2
569 0 1 if ($_ =~ /^\s*(\d*)\s*(\+?[<>].*)/)
588 0 40 $restore_fh ? :
0 0 unless $restore_fh ? print($EXE_GO "exe_with_exec\n") : 1 and exec do { $cmd[0] } @cmd
596 45 0 if @_ == 0
599 0 0 @_ ? :
614 0 0 if (_reftype($opt_ref) eq 'HASH')
622 0 0 if _reftype($_[0]) eq 'CODE'
625 0 0 unless defined $Background
629 0 0 if (defined $opt{'wait'} and $opt{'wait'} >= 0)
636 0 0 unless open $ORIGSTDOUT, '>&STDOUT'
648 0 0 unless ($defined_child)
650 0 0 if ($bg_fallback) { }
656 0 0 if carp('IPC::Exe::bg() cannot fork child', "\n ", $!)
661 0 0 if ($gotchild) { }
669 0 0 $status ? :
674 0 0 NON_UNIX ? :
680 0 0 if ($defined_child) { }
682 0 0 unless $defined_grand
689 0 0 if ($defined_grand) { }
691 0 0 if $gotgrand
707 0 0 if ($defined_grand and $gotgrand)
709 0 0 if ($defined_child) { }
723 0 0 if (not $gotgrand) { }
0 0 elsif (not $defined_child) { }
734 0 0 unless open *STDOUT, '>&=', $ORIGSTDOUT
738 0 0 if (NON_UNIX)
740 0 0 if (_is_fh($BG_GO2))
746 0 0 if (_is_fh($BG_GO1))
755 0 0 $_args ? :
770 0 0 if $defined_child and $defined_grand
771 0 0 if $defined_child and not $defined_grand
772 0 0 if not $defined_child and $defined_grand and not $gotgrand
786 0 1034 if $^O =~ /^(?:VMS|dos|MacOS|riscos|amigaos|vmesa)$/
788 0 1034 if (NON_UNIX) { }
793 0 0 unless open $ORIGSTDIN, '<&STDIN'
797 0 0 unless open $ORIGSTDOUT, '>&STDOUT'
801 0 0 unless open $ORIGSTDERR, '>&STDERR'
806 0 0 unless pipe $_[0], my $WRITE
809 0 0 unless pipe my $READY, $_[1]
813 0 0 if (defined($pid = fork))
815 0 0 if ($pid) { }
827 0 0 if defined $IPC::Exe::_preexec_wait
833 0 0 unless open *STDIN, '<&=', $ORIGSTDIN
836 0 0 unless open *STDOUT, '>&=', $ORIGSTDOUT
839 0 0 unless open *STDERR, '>&=', $ORIGSTDERR
848 0 0 unless open *STDOUT, '>&=', $WRITE