-
Notifications
You must be signed in to change notification settings - Fork 139
Closed
Description
Hi,
8d2bd87 (i.e. upgrading from boost 1.68 to boost 1.69) has introduced a regression where an fd for one of the child process pipes is not closed when there's nothing to read from it.
This leads to fd exhaustion after a while, e.g. with the following piece of code:
bp::ipstream stdout;
bp::child diffProcess(bp::search_path("diff"),
"--unified=1",
static_cast<std::string>(tmpFile1),
static_cast<std::string>(tmpFile2),
bp::std_out > stdout);
diffProcess.wait();
This patch is a workaround for the single case that we ran into, but there are probably more cases where the fd is not closed either. Please check :)
diff --git a/include/boost/process/detail/posix/executor.hpp b/include/boost/process/detail/posix/executor.hpp
index 1390a58..8b86ed1 100644
--- a/include/boost/process/detail/posix/executor.hpp
+++ b/include/boost/process/detail/posix/executor.hpp
@@ -282,7 +282,10 @@ class executor
set_error(std::error_code(err, std::system_category()), "Error read pipe");
}
if (count == 0)
+ {
+ ::close(source);
return ;
+ }
std::error_code ec(data[0], std::system_category());
std::string msg(data[1], ' ');
Thank You & BR,
Ingmar
Metadata
Metadata
Assignees
Labels
No labels