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: 6 additions & 1 deletion subprocess.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1408,7 +1408,12 @@ inline int Popen::wait() noexcept(false)
#ifdef __USING_WINDOWS__
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_;
Comment on lines +1411 to +1416
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have two questions:

  1. Why not check that WaitForSingleObject returns WAIT_OBJECT_0?

  2. Why not close process_handle_?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lunacd Can you please respond to the review questions whenever you get time ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not entirely sure on that part of the windows API. My fix was targeted at getting the return code, but both items sound like issues to follow up on too.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I created #114 for this. Feel free to assign that to me and I'll follow up on it when I got the time. #115 as well

#else
int ret, status;
std::tie(ret, status) = util::wait_for_child_exit(pid());
Expand Down