Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions subprocess.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1423,11 +1423,18 @@ inline int Popen::wait() noexcept(false)
#ifdef __USING_WINDOWS__
int ret = WaitForSingleObject(process_handle_, INFINITE);

// WaitForSingleObject with INFINITE should only return when process has signaled
if (ret != WAIT_OBJECT_0) {
throw OSError("Unexpected return code from WaitForSingleObject", 0);
}

DWORD dretcode_;

if (FALSE == GetExitCodeProcess(process_handle_, &dretcode_))
throw OSError("Failed during call to GetExitCodeProcess", 0);

CloseHandle(process_handle_);

return (int)dretcode_;
#else
int ret, status;
Expand Down