Branch Coverage

blib/lib/Parallel/Jobs.pm
Criterion Covered Total %
branch 98 154 63.6


line true false branch
56 0 27 if ($_[0] eq 'Parallel::Jobs')
62 0 27 if (not @_) { }
27 0 elsif (ref $_[0] eq 'HASH') { }
0 0 elsif (ref $_[0] eq 'SCALAR') { }
78 1 26 if ($params{'stdin_handle'}) { }
81 0 1 unless open $stdin_handle, '<&' . fileno($params{'stdin_handle'})
86 25 1 unless $params{'stdin_file'}
90 26 1 if ($params{'stdin_file'})
91 0 26 if ($stdin_handle)
97 0 26 unless (open $stdin_handle, $params{'stdin_file'})
106 5 22 if ($params{'stdout_handle'})
109 0 5 unless open $stdout_handle, '>&' . fileno($params{'stdout_handle'})
111 0 5 if $Parallel::Jobs::debug
118 10 17 if ($params{'stdout_capture'}) { }
12 5 elsif (not $stdout_handle) { }
119 0 10 if ($stdout_handle)
131 0 27 if ($params{'stderr_handle'})
134 0 0 unless open $stderr_handle, '>&' . fileno($params{'stderr_handle'})
141 10 17 if ($params{'stderr_capture'}) { }
17 0 elsif (not $stderr_handle) { }
142 0 10 if ($stderr_handle)
155 0 0 $stdin_handle ? :
0 0 $stdout_handle ? :
0 0 $stderr_handle ? :
0 27 if $Parallel::Jobs::debug
163 0 27 if ($@)
169 0 27 unless $pid
172 10 17 if ($capture_stdout)
174 0 10 if $Parallel::Jobs::debug
177 10 17 if ($capture_stderr)
179 0 10 if $Parallel::Jobs::debug
210 0 60 if (ref $_[0] eq 'HASH')
214 0 60 if $Parallel::Jobs::debug
216 5 0 unless (@pids or @dead_pids or @Parallel::Jobs::events)
221 41 74 if (not $Parallel::Jobs::stdout_handles{$pid} || $Parallel::Jobs::stderr_handles{$pid}) { }
225 53 21 if ($Parallel::Jobs::stdout_handles{$pid})
228 52 22 if ($Parallel::Jobs::stderr_handles{$pid})
234 55 0 unless (@dead_pids or $args{'nohang'})
235 18 37 if (@pid_only == @pids)
236 3 15 if (@Parallel::Jobs::events)
240 0 15 if $Parallel::Jobs::debug
242 0 15 if ($pid == -1)
247 0 15 if $Parallel::Jobs::debug
254 12 65 if (waitpid($pid, 1) > 0)
255 0 12 if $Parallel::Jobs::debug
257 9 3 if ($Parallel::Jobs::stdout_handles{$pid} or $Parallel::Jobs::stderr_handles{$pid})
270 0 65 if $Parallel::Jobs::debug
272 57 8 @Parallel::Jobs::events || $args{'nohang'} ? :
275 37 28 unless ($nfound)
276 0 37 unless (@Parallel::Jobs::events or $args{'nohang'})
277 0 0 unless $nfound
286 0 28 unless $waiting
289 16 12 if ($pid = $stdout_to_pid{$waiting}) { }
12 0 elsif ($pid = $stderr_to_pid{$waiting}) { }
311 8 20 if ($data ne '') { }
312 0 8 if $Parallel::Jobs::debug
316 0 20 if $Parallel::Jobs::debug
318 10 10 if ($type eq 'STDOUT')
322 10 10 if ($type eq 'STDERR')
326 9 11 if ($Parallel::Jobs::dead_pids{$pid} and not $Parallel::Jobs::stderr_handles{$pid} || $Parallel::Jobs::stdout_handles{$pid})
335 37 0 if (@Parallel::Jobs::events) { }
360 1 0 if ($outfile)
364 1 0 unless ($Parallel::Jobs::debug)
367 0 1 unless open DEVNULL, ">$devnull"
376 0 5 if ($Parallel::Jobs::debug) { }
382 2 3 unless ($params{'stdout_handle'} or $params{'stdout_capture'})
385 3 2 unless ($params{'stderr_handle'} or $params{'stderr_capture'})
392 0 25 unless $pid
393 0 25 if $Parallel::Jobs::debug
397 0 53 if $Parallel::Jobs::debug
400 5 0 unless ($Parallel::Jobs::debug)
401 2 3 unless ($params{'stdout_handle'} or $params{'stdout_capture'})
405 3 2 unless ($params{'stderr_handle'} or $params{'stderr_capture'})
411 1 0 if ($outfile)
418 0 1 unless open OUTFILE, $outfile
428 0 1 unless ($text =~ /^(?:foo\n)?baz\nscrelt\n$/)
435 0 1 unless open OUTFILE, $outfile