Branch Coverage

blib/lib/No/Worries/Proc.pm
Criterion Covered Total %
branch 120 208 57.6


line true false branch
48 54 0 if ($cmd[0] =~ m[/]) { }
49 0 54 unless -f $cmd[0] and -x _
53 0 0 unless length $dir and -d $dir
54 0 0 unless -f "$dir/$cmd[0]" and -x _
58 0 0 unless $cmd[0] =~ m[/]
107 64 1 if $ios
108 0 65 unless close $fh
123 44 0 unless $$proc{"fh$what"} and $$proc{"cb$what"}
129 68 20 unless $$proc{"fh$what"} and $$proc{"cb$what"}
134 0 27 if $iosr and not grep(($fh eq $_), $iosr->can_read(1))
137 0 27 unless defined $done
152 44 2095 if (waitpid($proc->{'pid'}, 1) == $proc->{'pid'})
161 2095 0 if (kill 0, $proc->{'pid'} or $! == 1)
176 43 11 unless defined $stdin
178 6 5 if ($ref eq '') { }
5 0 elsif ($ref eq 'SCALAR') { }
179 0 6 if ($stdin eq '') { }
183 0 6 unless open $rdrin, "<", $stdin
187 0 5 unless pipe $rdrin, $wrtin
201 2 52 unless defined $stdout
203 8 44 if ($ref eq '') { }
44 0 elsif ($ref eq 'CODE' or $ref eq 'SCALAR') { }
204 0 8 if ($stdout eq '') { }
208 0 8 unless open $wrtout, ">", $stdout
212 0 44 unless pipe $rdrout, $wrtout
215 0 44 if ($ref eq 'CODE') { }
234 15 39 unless defined $stderr
236 9 30 if ($ref eq '') { }
30 0 elsif ($ref eq 'CODE' or $ref eq 'SCALAR') { }
237 9 0 if ($stderr eq '') { }
242 0 0 unless open $wrterr, ">", $stderr
246 0 30 unless pipe $rdrerr, $wrterr
249 0 30 if ($ref eq 'CODE') { }
273 2 7 if ($rdrin)
275 2 0 if (fileno STDIN != $fd)
276 0 2 unless open *STDIN, "<&=$fd"
281 8 1 if ($wrtout)
283 8 0 if (fileno STDOUT != $fd)
284 0 8 unless open *STDOUT, ">&=$fd"
289 6 3 if ($wrterr or $merge)
290 1 5 $merge ? :
291 6 0 if (fileno STDERR != $fd)
292 0 6 unless open *STDERR, ">&=$fd"
323 0 54 if (defined $option{'cwd'})
324 0 0 unless -d $option{'cwd'}
332 0 54 unless defined $proc{'pid'}
338 9 45 unless ($proc{'pid'})
342 0 9 if defined $option{'cwd'}
345 27 0 unless tied $glob
351 14 13 unless $fh
352 0 13 unless close $fh
358 0 0 unless exec {$proc{'command'}[0];} @{$proc{'command'};}
369 6 39 if (defined $option{'timeout'})
373 0 45 if $option{'kill'}
376 57 78 unless $fh
377 0 78 unless close $fh
398 0 7 if (ref $proc eq '') { }
7 0 elsif (ref $proc eq 'HASH') { }
399 0 0 unless $proc =~ /^\d+$/
406 6 1 if @_
411 7 0 if ($spec =~ m[^([A-Z]+)/($nbre)$]) { }
416 0 7 unless (kill $sig, $pid)
417 0 0 unless $! == 3
421 7 7 unless &_is_alive($proc, $option{"_iosr"}, $option{'_iosw'})
424 0 0 unless &_is_alive($proc, $option{"_iosr"}, $option{'_iosw'})
428 0 0 unless (kill $sig, $pid)
429 0 0 unless $! == 3
452 73 65 unless $fh
453 4 61 if ($what eq 'in') { }
461 8 36 unless $iosr->count
462 40 4 unless $iosw->count
478 0 80 unless defined $done
482 41 39 unless ($done)
498 4 4 if (length $buf) { }
500 0 4 unless defined $done
519 2088 37 if &_is_alive($proc, $iosr, $iosw)
525 252 6 unless $now > $proc->{'maxtime'}
553 42 2 if (ref $procs eq 'HASH') { }
0 2 elsif (ref $procs ne 'ARRAY') { }
558 2 42 if @_
569 1 43 if defined $option{'timeout'}
575 1522 567 if $iosr
578 8 2081 if $iosw
582 0 2089 if $maxtime and &Time::HiRes::time() > $maxtime
586 1 2088 if $option{'deaths'} and grep(defined($_->{'status'}), values %{$process;}) >= $zombies + $option{'deaths'}
588 2006 82 if $timeout
590 602 1486 unless $iosr and $iosr->count
591 2084 4 unless $iosw and $iosw->count
608 6 36 if wantarray
622 0 3 if $status
637 0 0 if @_
642 0 0 unless defined $pid
643 0 0 if ($pid)
646 0 0 if $option{'callback'}
651 0 0 if $sid == -1
653 0 0 unless (-f STDIN)
654 0 0 unless open STDIN, "<", "/dev/null"
657 0 0 unless (-f STDOUT)
658 0 0 unless open STDOUT, ">", "/dev/null"
661 0 0 unless (-f STDERR)
662 0 0 unless open STDERR, ">", "/dev/null"
675 3 3 unless $status
678 0 3 if $signum
680 0 3 if $status & 128