From b3f330bd80da048fac34db28b6319fbddbfadab1 Mon Sep 17 00:00:00 2001 From: philippewarren Date: Tue, 15 Mar 2022 13:58:20 -0400 Subject: [PATCH] Fix execute_process blocking on Windows --- subprocess.hpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/subprocess.hpp b/subprocess.hpp index 8c74c2b..7bd2d0f 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);