mirror of
https://github.com/arun11299/cpp-subprocess.git
synced 2025-08-04 12:26:19 -04:00
Get Windows return code in wait()
Currently, wait() returns 0 on windows regardless of the actual return code of processes.
This commit is contained in:
parent
3afe581c1f
commit
50db2113ff
@ -1408,7 +1408,12 @@ inline int Popen::wait() noexcept(false)
|
|||||||
#ifdef __USING_WINDOWS__
|
#ifdef __USING_WINDOWS__
|
||||||
int ret = WaitForSingleObject(process_handle_, INFINITE);
|
int ret = WaitForSingleObject(process_handle_, INFINITE);
|
||||||
|
|
||||||
return 0;
|
DWORD dretcode_;
|
||||||
|
|
||||||
|
if (FALSE == GetExitCodeProcess(process_handle_, &dretcode_))
|
||||||
|
throw OSError("Failed during call to GetExitCodeProcess", 0);
|
||||||
|
|
||||||
|
return (int)dretcode_;
|
||||||
#else
|
#else
|
||||||
int ret, status;
|
int ret, status;
|
||||||
std::tie(ret, status) = util::wait_for_child_exit(pid());
|
std::tie(ret, status) = util::wait_for_child_exit(pid());
|
||||||
|
Loading…
x
Reference in New Issue
Block a user