prevent pipe command from running commands multiple times.

This commit is contained in:
Kelvin Sherlock 2016-08-11 11:56:51 -04:00
parent 87f5398649
commit bdba86249e
1 changed files with 2 additions and 1 deletions

View File

@ -550,8 +550,9 @@ int pipe_command::execute(Environment &e, const fdmask &fds, bool throwup) {
lseek(fd, 0, SEEK_SET);
rv = children[1]->execute(e, pipe_fd | fds, throwup);
return e.status(rv, throwup);
}
if (children[0]) return children[0]->execute(e, fds, throwup);
if (children[1]) return children[1]->execute(e, fds, throwup);
return e.status(0, throwup);