Fix execute_process blocking on Windows (#76)

This commit is contained in:
philippewarren 2022-05-15 12:10:30 -04:00 committed by GitHub
parent 2bec886e79
commit bf4289c1a0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1330,6 +1330,7 @@ private:
#ifdef __USING_WINDOWS__
HANDLE process_handle_;
std::future<void> 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);