From bdba86249e31d06eba2ede4d72b472ba352d6073 Mon Sep 17 00:00:00 2001 From: Kelvin Sherlock Date: Thu, 11 Aug 2016 11:56:51 -0400 Subject: [PATCH] prevent pipe command from running commands multiple times. --- command.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/command.cpp b/command.cpp index b5b5d23..116135f 100644 --- a/command.cpp +++ b/command.cpp @@ -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);