diff options
-rw-r--r-- | capture.c | 13 | ||||
-rw-r--r-- | t/TestCapture.pm | 2 |
2 files changed, 7 insertions, 8 deletions
@@ -165,19 +165,18 @@ capture_new(SV *program, ARGV argv, unsigned timeout, SV *cb[2], SV *input) void capture_DESTROY(struct capture *cp) { if (cp->program != &PL_sv_undef) SvREFCNT_dec(cp->program); - if (cp->input != &PL_sv_undef) { + if (cp->input != &PL_sv_undef) SvREFCNT_dec(cp->input); - /* Make sure runcap_free won't free the input sc_base pointer - */ - cp->rc.rc_cap[RUNCAP_STDIN].sc_base = NULL; - cp->rc.rc_cap[RUNCAP_STDIN].sc_fd = -1; - } + /* Make sure runcap_free won't free the input sc_base pointer + */ + cp->rc.rc_cap[RUNCAP_STDIN].sc_base = NULL; + cp->rc.rc_cap[RUNCAP_STDIN].sc_fd = -1; free(cp->closure[0].str); if (cp->closure[0].cv != &PL_sv_undef) SvREFCNT_dec(cp->closure[0].cv); free(cp->closure[1].str); @@ -275,9 +274,9 @@ capture_run(struct capture *cp) call_monitor(cp->closure[1].cv, cp->closure[1].str, cp->closure[1].len); cp->closure[1].len = 0; } - return res; + return res == 0; } diff --git a/t/TestCapture.pm b/t/TestCapture.pm index c7f31e3..8e8bf95 100644 --- a/t/TestCapture.pm +++ b/t/TestCapture.pm @@ -49,13 +49,13 @@ sub test_stream { return 1; } sub TestCapture { my ($argv, %kw) = @_; - $kw{result} = 0 unless exists $kw{result}; + $kw{result} = 1 unless exists $kw{result}; $kw{code} = 0 unless exists $kw{code}; my $cap; if (ref($argv) eq 'ARRAY') { $cap = new POSIX::Run::Capture $argv; } elsif (ref($argv) eq 'HASH') { |