From a458bcfc4a4f5195ca55de0ae73ce6236d6de607 Mon Sep 17 00:00:00 2001 From: Arun Muralidharan Date: Thu, 9 Apr 2020 17:34:16 +0530 Subject: [PATCH 1/3] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index ab21bf2..206e7b0 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -![Subprocessing in C++] +## [Subprocessing in C++] ## Design Goals The only goal was to develop something that is as close as python2.7 subprocess module in dealing with processes. From f1a698b50e53e34db17e730c259cb60f023ccff2 Mon Sep 17 00:00:00 2001 From: Dilshod Mukhtarov Date: Tue, 14 Apr 2020 18:59:25 +0400 Subject: [PATCH 2/3] Forked subprocess not exited if execve failed (#54) * Fixed: forked subprocess not exited if execve failed In lengthy processes (daemons, etc) this bug keeps open this subprocess. The subprocess continues to work (parallel to parent process) from after failed command start * Fixed: deadlock on using multithreaded application For example if application uses spdlog logger library and set spdlog::flush_every(std::chrono::seconds(1)); then it starts it's own thread which flushes logs every 1 second. In this case if execve failed to execute given command, then parent and subprocess deadlocked. --- subprocess.hpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/subprocess.hpp b/subprocess.hpp index fb93766..e6485f2 100755 --- a/subprocess.hpp +++ b/subprocess.hpp @@ -670,7 +670,7 @@ struct input } input(IOTYPE typ) { assert (typ == PIPE && "STDOUT/STDERR not allowed"); -#ifndef _MSC_VER +#ifndef _MSC_VER std::tie(rd_ch_, wr_ch_) = util::pipe_cloexec(); #endif } @@ -1668,12 +1668,11 @@ namespace detail { std::string err_msg(exp.what()); //ATTN: Can we do something on error here ? util::write_n(err_wr_pipe_, err_msg.c_str(), err_msg.length()); - throw; } // Calling application would not get this // exit failure - exit (EXIT_FAILURE); + _exit (EXIT_FAILURE); #endif } From 2f6bb248c665acc50799466b20ea8659fcadd148 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?N=C3=A9meth=20=C3=81d=C3=A1m?= Date: Sun, 3 May 2020 18:54:29 +0200 Subject: [PATCH 3/3] fix for poll() function where the _child_created value is only ever set when not compiling on windows so on windows it should be omitted (#56) --- subprocess.hpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/subprocess.hpp b/subprocess.hpp index e6485f2..1addd9b 100755 --- a/subprocess.hpp +++ b/subprocess.hpp @@ -1299,7 +1299,10 @@ inline int Popen::wait() noexcept(false) inline int Popen::poll() noexcept(false) { int status; + +#ifndef _MSC_VER if (!child_created_) return -1; // TODO: ?? +#endif #ifdef _MSC_VER int ret = WaitForSingleObject(process_handle_, 0);