-
-
Notifications
You must be signed in to change notification settings - Fork 30k
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
Popen.communicate documentation does not say how to get the return code #84884
Comments
When using subprocess.Popen.communicate(), it is natural to wonder how to get
If you can guess that communicate() might set returncode, then you can find
I suggest that the documentation for communicate() be updated to mention that |
This is not a security issue. |
Can you attach a script or post an interactive session, with both success and failure, showing that returncode is set appropriately after reading output? Possible calls: '''python -c "print('Success')"''', "raise Exception('Failure')". Or point to a test in test_subprocess. |
The following test cases in test_subprocess.py call the communicate() method and then immediately assert that returncode attribute has the expected value:
You'll see that some of these test for success (returncode == 0) and some for failure (returncode == 1). This seems like adequate test coverage to me, but if something is missing, let me know. |
Is there anything I can do to move this forward? |
Will merge after CI passes the addition of 'the'. |
Thanks for the fix. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: