Add errors="backslashreplace" to run_with_env_secrets.py #5456
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
See: https://fb.workplace.com/groups/4571909969591489/permalink/7818394354943018/
ExecuTorch CI was running into an issue where non-utf8 print output caused tests to crash. This was resolved by removing the printing in pytorch/executorch#4268.
This PR updates the error handling to use
backslashreplace
, which should still show us the error/printing, but without crashing the test.From https://docs.python.org/3.9/library/io.html#io.TextIOWrapper:
From https://docs.python.org/3/library/subprocess.html#frequently-used-arguments:
If encoding or errors are specified, or text (also known as universal_newlines) is true, the file objects stdin, stdout and stderr will be opened in text mode using the encoding and errors specified in the call or the defaults for io.TextIOWrapper.