Branch Coverage

blib/lib/Command/Run.pm
Criterion Covered Total %
branch 119 172 69.1


line true false branch
17 0 0 if (@_) { }
24 0 89 if $cv->GV->isa("B::SPECIAL")
37 154 56 if @_
46 154 200 if ($key eq 'command') { }
51 149 elsif ($key eq 'stdin') { }
17 132 elsif ($key eq 'stdout') { }
33 99 elsif ($key eq 'stderr') { }
47 154 0 ref $val eq 'ARRAY' ? :
53 6 27 if (ref $val eq 'SCALAR') { }
68 210 215 if (@_) { }
78 0 132 if (@_ == 1) { }
91 13 151 if (my $ref = $obj->{'STDOUT_REF'})
94 5 159 if (my $ref = $obj->{'STDERR_REF'})
104 195 0 if (@command)
108 0 172 unless $fh->seek(0, 0)
109 0 172 unless $fh->truncate(0)
112 0 172 unless $fh->seek(0, 0)
127 195 0 ref $command eq 'ARRAY' ? :
130 81 114 if ($opt{'nofork'} and ref $command[0] eq "CODE")
137 0 114 unless pipe my $stdout_r, my $stdout_w
138 11 103 if $stderr eq "capture"
141 23 91 if ($pid == 0)
144 4 19 if $stderr eq "capture"
146 1 22 if (exists $opt{'stdin'}) { }
5 17 elsif (my $input = $obj->{'INPUT'}) { }
147 0 1 unless my $tmp = "IO::File"->new_tmpfile
150 0 1 unless $tmp->seek(0, 0)
151 0 1 unless open STDIN, "<&", $tmp
154 0 5 unless open STDIN, "<&=", $input->fileno
158 0 23 unless open STDOUT, ">&=", $stdout_w->fileno
159 3 20 if ($stderr eq 'redirect') { }
4 16 elsif ($stderr eq 'capture') { }
160 0 3 unless open STDERR, ">&STDOUT"
162 0 4 unless open STDERR, ">&=", $stderr_w->fileno
166 8 15 if (ref $command[0] eq "CODE")
169 8 0 if (my $name = code_name($code))
181 7 84 if $stderr eq "capture"
184 7 84 if $stderr eq "capture"
187 7 84 $stderr eq 'capture' ? :
190 7 84 if $stderr eq "capture"
205 19 135 if $opt{'raw'}
207 0 144 unless my $f = "IO::File"->new_tmpfile
208 17 127 $opt{'raw'} ? :
211 0 154 unless $fh->seek(0, 0)
212 0 154 unless $fh->truncate(0)
226 176 0 if defined $_
88 0 if (grep {/^encoding\b/u if defined $_;} @layers[-2, -1])
242 29 88 if ($raw) { }
243 29 0 unless $was_utf8
262 0 81 unless open my $save_stdout, ">&", \*STDOUT
264 0 81 unless open STDOUT, ">&", $tmp_stdout
265 15 66 $raw ? :
269 3 78 if ($stderr_mode eq 'redirect') { }
9 69 elsif ($stderr_mode eq 'capture') { }
270 0 3 unless open $save_stderr, ">&", \*STDERR
271 0 3 unless open STDERR, ">&", \*STDOUT
274 0 9 unless open $save_stderr, ">&", \*STDERR
275 0 9 unless open STDERR, ">&", $tmp_stderr
281 13 68 if (exists $opt{'stdin'}) { }
23 45 elsif (my $input = $obj->{'INPUT'}) { }
284 0 13 unless $tmp_stdin->seek(0, 0)
285 0 13 unless open $save_stdin, "<&", \*STDIN
287 0 13 unless open STDIN, "<&", $tmp_stdin
288 4 9 $raw ? :
290 0 23 unless $input->seek(0, 0)
291 0 23 unless open $save_stdin, "<&", \*STDIN
293 0 23 unless open STDIN, "<&", $input->fileno
294 10 13 $raw ? :
301 81 0 if (my $name = code_name($code))
309 6 75 if ($@)
319 0 81 unless open STDOUT, ">&", $save_stdout
320 12 69 if ($save_stderr)
322 0 12 unless open STDERR, ">&", $save_stderr
324 36 45 if ($save_stdin)
326 0 36 unless open STDIN, "<&", $save_stdin
328 81 0 if (defined $orig_0)
333 0 81 unless $tmp_stdout->seek(0, 0)
337 9 72 if ($tmp_stderr)
338 0 9 unless $tmp_stderr->seek(0, 0)
351 0 25 if (@_)
355 0 0 unless $fh->seek(0, 0)
356 0 0 unless $fh->truncate(0)
359 0 0 unless $fh->seek(0, 0)
372 172 1 if (@_) { }
379 0 51 unless $input->fcntl(2, 0)
381 0 51 unless $input->seek(0, 0)