Branch Coverage

blib/lib/Command/Run.pm
Criterion Covered Total %
branch 113 164 68.9


line true false branch
17 0 0 if (@_) { }
24 0 69 if $cv->GV->isa("B::SPECIAL")
37 134 56 if @_
46 134 140 if ($key eq 'command') { }
31 109 elsif ($key eq 'stdin') { }
17 92 elsif ($key eq 'stdout') { }
33 59 elsif ($key eq 'stderr') { }
47 134 0 ref $val eq 'ARRAY' ? :
53 6 27 if (ref $val eq 'SCALAR') { }
68 190 195 if (@_) { }
78 0 92 if (@_ == 1) { }
91 13 131 if (my $ref = $obj->{'STDOUT_REF'})
94 5 139 if (my $ref = $obj->{'STDERR_REF'})
104 175 0 if (@command)
108 0 152 unless $fh->seek(0, 0)
109 0 152 unless $fh->truncate(0)
112 0 152 unless $fh->seek(0, 0)
127 175 0 ref $command eq 'ARRAY' ? :
130 61 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 9 105 if $opt{'raw'}
207 0 104 unless my $f = "IO::File"->new_tmpfile
208 7 97 $opt{'raw'} ? :
211 0 114 unless $fh->seek(0, 0)
212 0 114 unless $fh->truncate(0)
229 0 61 unless open my $save_stdout, ">&", \*STDOUT
230 0 61 unless open STDOUT, ">&", $tmp_stdout
231 5 56 $raw ? :
235 3 58 if ($stderr_mode eq 'redirect') { }
9 49 elsif ($stderr_mode eq 'capture') { }
236 0 3 unless open $save_stderr, ">&", \*STDERR
237 0 3 unless open STDERR, ">&", \*STDOUT
240 0 9 unless open $save_stderr, ">&", \*STDERR
241 0 9 unless open STDERR, ">&", $tmp_stderr
246 13 48 if (exists $opt{'stdin'}) { }
3 45 elsif (my $input = $obj->{'INPUT'}) { }
249 0 13 unless $tmp_stdin->seek(0, 0)
250 0 13 unless open $save_stdin, "<&", \*STDIN
251 0 13 unless open STDIN, "<&", $tmp_stdin
252 4 9 $raw ? :
254 0 3 unless $input->seek(0, 0)
255 0 3 unless open $save_stdin, "<&", \*STDIN
256 0 3 unless open STDIN, "<&", $input->fileno
257 0 3 $raw ? :
264 61 0 if (my $name = code_name($code))
272 6 55 if ($@)
278 0 61 unless open STDOUT, ">&", $save_stdout
279 12 49 if ($save_stderr)
281 0 12 unless open STDERR, ">&", $save_stderr
283 16 45 if ($save_stdin)
284 0 16 unless open STDIN, "<&", $save_stdin
286 61 0 if (defined $orig_0)
291 0 61 unless $tmp_stdout->seek(0, 0)
295 9 52 if ($tmp_stderr)
296 0 9 unless $tmp_stderr->seek(0, 0)
309 0 25 if (@_)
313 0 0 unless $fh->seek(0, 0)
314 0 0 unless $fh->truncate(0)
317 0 0 unless $fh->seek(0, 0)
330 152 1 if (@_) { }
337 0 31 unless $input->fcntl(2, 0)
339 0 31 unless $input->seek(0, 0)