Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot access process retcode after communicate() #13

Closed
matthijskooijman opened this issue Apr 14, 2018 · 2 comments
Closed

Cannot access process retcode after communicate() #13

matthijskooijman opened this issue Apr 14, 2018 · 2 comments

Comments

@matthijskooijman
Copy link

It seems that only Popen::poll() sets Popen::retcode_ (which can be retrieved using Popen::retcode()), but Popen::communicate() instead calls Popen::wait() and throws away the result. I tried calling Popen::poll() myself, but it seems that just returns 0 (IIRC waitpid will only work once).

A simple fix seems to be to let communicate() do retcode_ = wait();, which works, but I'm not sure if that's the best approach here (perhaps wait() should just set it?).

@arun11299
Copy link
Owner

Hello @matthijskooijman
Thanks for reporting the issue.
I think its best that wait returns the retcode instead of setting itself. Thats what I have done in the commit as well.

@matthijskooijman
Copy link
Author

Thanks. It seems that setting the return code in wait() would be more like the python version, though: https://stackoverflow.com/a/5631819/740048 (but if you manually call wait, you can of course just save the retcode yourself, so it's not a very big deal).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants