if (!c->input(c)) return 0;
c->b = c->buffer;
}
- if (globs.gl_pathc) {
- globfree(&globs);
- globs.gl_pathc = 0;
- }
c->t = c->tokens;
c->r = c->redirects;
c->r->mode = NONE;
c->prev = c->current;
+
+ if (globs.gl_pathc) {
+ globfree(&globs);
+ globs.gl_pathc = 0;
+ }
prevsublen = globbing = 0;
for (*c->t = c->b; *c->b; ++c->b) switch (*c->b) {
setsigchld(&actbg);
if (!parse(c)) return 0;
setsigchld(&actdefault);
+
islist = c->prev.term > BG || c->current.term > BG;
if (c->t) {
if (c->current.term == BG && fullbg()) {
}
if (!(path = getpath(c->current.name))) {
note("Couldn't find `%s' command", c->current.name);
- if (c->prev.term == PIPE) {
- killpg(pipeid, SIGKILL);
- }
+ if (c->prev.term == PIPE) killpg(pipeid, SIGKILL);
return quit(c);
}
}
exec(path, c);
}
- if (ispipestart) pipeid = cpid;
+ if (ispipestart) pipeid = cpid; else closepipe(c->prev);
jobid = pipeid;
} else if (!c->r && isbuiltin(c->tokens)) cpid = 0;
else if ((jobid = cpid = fork()) == -1) {