diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2017-07-23 14:47:52 +0300 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2017-07-23 14:47:52 +0300 |
commit | 1718b7e87b3ce2d588f2412ac41bea6e7048709f (patch) | |
tree | 07e1ff5864cd8b323f7720e02c8988e4b7366462 | |
parent | 6ffdc2c388a93365c4ec0ee5cb37296b120b2e3c (diff) | |
download | posixruncapture-1718b7e87b3ce2d588f2412ac41bea6e7048709f.tar.gz posixruncapture-1718b7e87b3ce2d588f2412ac41bea6e7048709f.tar.bz2 |
Change return value of capture_run to conform to Perl convention
* capture.c (capture_run): Return true on success.
* t/TestCapture.pm: Expect true on success
-rw-r--r-- | capture.c | 13 | ||||
-rw-r--r-- | t/TestCapture.pm | 2 |
2 files changed, 7 insertions, 8 deletions
@@ -168,13 +168,12 @@ 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) @@ -278,6 +277,6 @@ capture_run(struct capture *cp) 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 @@ -52,7 +52,7 @@ sub test_stream { 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; |