diff options
Diffstat (limited to 'Capture.xs')
-rw-r--r-- | Capture.xs | 28 |
1 files changed, 24 insertions, 4 deletions
@@ -85,18 +85,30 @@ capture_set_argv_ref(cp, argv) void capture_set_program(cp, prog) POSIX::Run::Capture cp; - char *prog; - CODE: + char *prog = NO_INIT; + PPCODE: if (cp->program != &PL_sv_undef) SvREFCNT_dec(cp->program); cp->program = ST(1); if (cp->program != &PL_sv_undef) { SvREFCNT_inc(cp->program); - cp->rc.rc_program = prog; + cp->rc.rc_program = SvPV_nolen(cp->program); cp->flags |= RCF_PROGRAM; } else cp->flags &= ~RCF_PROGRAM; - + +void +capture_set_timeout(cp, timeout) + POSIX::Run::Capture cp; + unsigned timeout; + CODE: + if (timeout) { + cp->rc.rc_timeout = timeout; + cp->flags |= RCF_TIMEOUT; + } else { + cp->flags &= ~RCF_TIMEOUT; + } + ARGV capture_argv(cp) POSIX::Run::Capture cp; @@ -116,6 +128,14 @@ capture_program(cp) ST(0) = cp->program; XSRETURN(1); +unsigned +capture_timeout(cp) + POSIX::Run::Capture cp; + CODE: + RETVAL = (cp->flags & RCF_TIMEOUT) ? cp->rc.rc_timeout : 0; + OUTPUT: + RETVAL + int capture_run(cp) POSIX::Run::Capture cp; |