mirror of
https://github.com/arun11299/cpp-subprocess.git
synced 2025-08-04 20:36:20 -04:00
Fix execute_process blocking on Windows (#76)
This commit is contained in:
parent
2bec886e79
commit
bf4289c1a0
@ -1330,6 +1330,7 @@ private:
|
|||||||
|
|
||||||
#ifdef __USING_WINDOWS__
|
#ifdef __USING_WINDOWS__
|
||||||
HANDLE process_handle_;
|
HANDLE process_handle_;
|
||||||
|
std::future<void> cleanup_future_;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
bool defer_process_start_ = false;
|
bool defer_process_start_ = false;
|
||||||
@ -1555,7 +1556,7 @@ inline void Popen::execute_process() noexcept(false)
|
|||||||
|
|
||||||
this->process_handle_ = piProcInfo.hProcess;
|
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);
|
WaitForSingleObject(this->process_handle_, INFINITE);
|
||||||
|
|
||||||
CloseHandle(this->stream_.g_hChildStd_ERR_Wr);
|
CloseHandle(this->stream_.g_hChildStd_ERR_Wr);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user