From f2fd2b125aceb992548c817f9563805401a4436a Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Thu, 8 Mar 2012 21:15:37 +0000 Subject: [PATCH] support read error in shell_eval --- src/command_manager.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/command_manager.cc b/src/command_manager.cc index ac3e1b89..3285c8c8 100644 --- a/src/command_manager.cc +++ b/src/command_manager.cc @@ -116,7 +116,11 @@ static void shell_eval(std::vector& params, std::string output; char buffer[1024]; while (size_t size = read(read_pipe[0], buffer, 1024)) + { + if (size == -1) + break; output += std::string(buffer, buffer+size); + } close(read_pipe[0]); waitpid(pid, NULL, 0);