Skip to content

Commit

Permalink
Use the encoding of stdout (fd 1) to decode the output of subprocess.…
Browse files Browse the repository at this point in the history
…Popen.

Co-authored-by: Ned Batchelder <ned@nedbatchelder.com>
  • Loading branch information
devdanzin and nedbat committed May 10, 2024
1 parent d81f5f3 commit 4827257
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion tests/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def run_command(cmd: str) -> tuple[int, str]:
status = proc.returncode

# Get the output, and canonicalize it to strings with newlines.
encoding = os.device_encoding(0) or locale.getpreferredencoding()
encoding = os.device_encoding(1) or locale.getpreferredencoding()
output_str = output.decode(encoding).replace("\r", "")
return status, output_str

Expand Down

0 comments on commit 4827257

Please sign in to comment.