-
-
Notifications
You must be signed in to change notification settings - Fork 17
Open
Labels
bugSomething isn't workingSomething isn't working
Description
subprocess-tee errors when the subprocess prints a non- utf-8 character.
This is a difference between subprocess and subprocess-tee.
Reproduction
# my_script.sh
echo -e "\xC0\x80"# reproducer.py
import subprocess
import subprocess_tee
print("Subprocess:")
subprocess.run(args=["bash", "my_script.sh"])
print("Subprocess tee:")
subprocess_tee.run(args=["bash", "my_script.sh"])subprocess will replace invalid bytes with a placeholder character, while subprocess-tee errors with:
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xc0 in position 0: invalid start byte
Fix
I suggest using errors="replace" on line.decode().
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working