Skip to content

Use capture_output=True instead of stdout=PIPE, stderr=PIPE (UP022) - #5576

Open
AniketBajaj2024 wants to merge 1 commit into
Osmantic:mainfrom
AniketBajaj2024:fix/up022-subprocess-capture-output
Open

AniketBajaj2024 wants to merge 1 commit into
Osmantic:mainfrom
AniketBajaj2024:fix/up022-subprocess-capture-output

Conversation

@AniketBajaj2024

Copy link
Copy Markdown
Contributor

subprocess.run accepts capture_output as shorthand for passing both PIPE arguments. Ruff marks this fix 'unsafe' because the rewrite is invalid for subprocess.Popen, which has no capture_output parameter — verified all four call sites are subprocess.run, with zero Popen usage in the diff.

Confirmed equivalence at runtime: both spellings produce identical stdout and stderr. All four touched files byte-compile.

subprocess.run accepts capture_output as shorthand for passing both
PIPE arguments. Ruff marks this fix 'unsafe' because the rewrite is
invalid for subprocess.Popen, which has no capture_output parameter —
verified all four call sites are subprocess.run, with zero Popen usage
in the diff.

Confirmed equivalence at runtime: both spellings produce identical
stdout and stderr. All four touched files byte-compile.
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

Successfully merging this pull request may close these issues.

1 participant