From bf4289c1a065e4967b64cf4f200ec66592e7b936 Mon Sep 17 00:00:00 2001 From: philippewarren <55722645+philippewarren@users.noreply.github.com> Date: Sun, 15 May 2022 12:10:30 -0400 Subject: [PATCH] Fix execute_process blocking on Windows (#76) --- subprocess.hpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/subprocess.hpp b/subprocess.hpp index 1a46808..e6ea910 100755 --- a/subprocess.hpp +++ b/subprocess.hpp @@ -1330,6 +1330,7 @@ private: #ifdef __USING_WINDOWS__ HANDLE process_handle_; + std::future cleanup_future_; #endif bool defer_process_start_ = false; @@ -1555,7 +1556,7 @@ inline void Popen::execute_process() noexcept(false) this->process_handle_ = piProcInfo.hProcess; - std::async(std::launch::async, [this] { + this->cleanup_future_ = std::async(std::launch::async, [this] { WaitForSingleObject(this->process_handle_, INFINITE); CloseHandle(this->stream_.g_hChildStd_ERR_Wr);