aboutsummaryrefslogtreecommitdiff
path: root/capture.c
diff options
context:
space:
mode:
Diffstat (limited to 'capture.c')
-rw-r--r--capture.c33
1 files changed, 20 insertions, 13 deletions
diff --git a/capture.c b/capture.c
index 61398de..4d2c04c 100644
--- a/capture.c
+++ b/capture.c
@@ -67,7 +67,9 @@ capture_new(AV *av, unsigned timeout, SV *cb[2])
if (!psv)
croak("element %d doesn't exist", i);
sv = *psv;
- if (SvTYPE(sv) == SVt_PV) {
+ if (SvROK(sv)) {
+ croak("argument #%d is not a scalar", i);
+ } else {
char *s = SvPV_nolen(sv);
if ((argv[i] = strdup(s)) == NULL)
goto nomem;
@@ -148,22 +150,27 @@ capture_next_line(struct capture *cp, int fd)
int
capture_run(struct capture *cp)
{
+ int res;
+
if (!cp->rc.rc_argv)
croak("no command line given");
- return runcap(&cp->rc, cp->flags);
-}
+ res = runcap(&cp->rc, cp->flags);
-void
-capture_wd()
-{
- volatile int _st=0;
- printf("ENTER\n");
- while (!_st) {
- printf("WAIING\n");
- sleep(1);
- _st = _st;
+ if (cp->flags & RCF_STDOUT_LINEMON && cp->closure[0].len) {
+ call_monitor(cp->closure[0].cv,
+ cp->closure[0].str,
+ cp->closure[0].len);
+ cp->closure[0].len = 0;
}
- printf("EXIT\n");
+
+ if (cp->flags & RCF_STDERR_LINEMON && cp->closure[1].len) {
+ call_monitor(cp->closure[1].cv,
+ cp->closure[1].str,
+ cp->closure[1].len);
+ cp->closure[1].len = 0;
+ }
+
+ return res;
}

Return to:

Send suggestions and report system problems to the System administrator.