This is an archive of the discontinued LLVM Phabricator instance.

[LNT] Python 3 support: subprocess IO as text
ClosedPublic

Authored by thopre on Oct 14 2019, 3:18 AM.

Details

Summary

In Python 3, subprocess stdin, stdout and stderr are in binary mode by
default. Trying to print or parse those as text as is done thoughought
in LNT then causes byte/str errors. This commits sets the
universal_newlines parameter to True when invoking subprocess methods
involving input or output to request those to be in text mode. It also
adapt _check_output to work whether universal_newlines is set to True in
the caller or not. Finally, it cleans up 2 cases subprocess method call
where the output file objects are stored in a variable but not used.

Event Timeline

thopre created this revision.Oct 14 2019, 3:18 AM
This revision is now accepted and ready to land.Dec 5 2019, 7:54 AM
thopre closed this revision.Dec 5 2019, 8:37 AM