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

subprocess: stdout set to subprocess.STDOUT is incorrectly handled #98966

Open
ptsneves opened this issue Nov 1, 2022 · 0 comments
Open

subprocess: stdout set to subprocess.STDOUT is incorrectly handled #98966

ptsneves opened this issue Nov 1, 2022 · 0 comments
Labels
type-bug An unexpected behavior, bug, or error

Comments

@ptsneves
Copy link

ptsneves commented Nov 1, 2022

Bug report

import subprocess
subprocess.run('true', stdout=subprocess.STDOUT, cwd='./')

Expected output:

  • Some kind of error stating that the stdout argument cannot take a subprocess.STDOUT. That subprocess.STDOUT is only valid for stderr

Actual output:

OSError: [Errno 9] Bad file descriptor: './'

I reproduce this with the latest Python main branch as well as Python 3.10 but I see no indication this issue was ever addressed

@ptsneves ptsneves added the type-bug An unexpected behavior, bug, or error label Nov 1, 2022
ptsneves added a commit to ptsneves/cpython that referenced this issue Nov 1, 2022
Explicitly handle the case where stdout=STDOUT
as otherwise the existing error handling gets
confused and reports hard to understand errors.
ptsneves added a commit to ptsneves/cpython that referenced this issue Nov 1, 2022
Explicitly handle the case where stdout=STDOUT
as otherwise the existing error handling gets
confused and reports hard to understand errors.

Signed-off-by: Paulo Neves <ptsneves@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

1 participant