-
-
Notifications
You must be signed in to change notification settings - Fork 32k
Clarify documentation for redirected stdout/stderr when using subprocess in Linux #88324
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
Comments
https://docs.python.org/3/library/subprocess.html#frequently-used-arguments "
https://docs.python.org/3/library/contextlib.html?highlight=contextlib#contextlib.redirect_stdout " It took me a while to realize that redirecting stdout and stderr didn't have an effect in the child subprocess. It would be great if this could be improved so the subproccess-ed command also inherits the redirection. At the very least, this issue with the redirection should be added as a notice in the subprocess documentation. The attached test.py script shows this behavior. The code is very simple and self-explanatory. You can run with: # test.py or # test.py -n Somehow, related to: https://bugs.python.org/issue1227748 |
Hmm, I'm not quite following - when you say that the subproccess-ed command should also inherit the redirection, which subprocess command are you referring to, and nested or unnested? I gave it a ran and everything seems to run how I'd expected it, so maybe put another way, what's the expected output from the files and stdout/stderr? |
…ng subprocess in Linux (#94035) * Update description of stdout, stderr, and stdin. Changes: - Move the ``None`` option (which is default) to the front of the list of input options - Move the ``None`` option description up to make the default behavior more clear (No redirection) - Remove mention of Child File Descriptors from ``None`` option description
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: