Initialize colorama on Windows
Categories
(Firefox Build System :: Mach Core, enhancement)
Tracking
(Not tracked)
People
(Reporter: ahochheiden, Assigned: ahochheiden)
Details
Attachments
(1 obsolete file)
On Windows, in certain cases where STDOUT/STDERR output is captured from a subprocess, if it contains color information, it is not parsed correctly.
Example:
./mach python-test --subsuite=mozversioncontrol
Produces output like:
0:21.70 python/mozversioncontrol/test/test_update.py::test_update[git] ←[32mPASSED←[0m
0:21.70 python/mozversioncontrol/test/test_update.py::test_update[hg] ←[32mPASSED←[0m
0:21.70
0:21.72 ←[32m←[1m========================== 2 passed in 6.51 seconds ===========================←[0m
0:21.72
The ←[32m
is supposed to make subsequent text green. (See 32 under Text Formatting)
I discovered that initializing colorama before the loggers are created with sys.stdout
solves this problem. It wraps the sys.stdout
write()
and that makes all subsequent writes on all logger streams correctly parse/interpret the color sequences.
Assignee | ||
Comment 1•3 years ago
|
||
Comment 2•3 years ago
|
||
I think the intent of this ticket is captured by the "fix color output of Mach" bug.
Also, fwiw, in general I'd recommend describing tickets by what they'll improve, rather than the implementation change (if possible).
There will be things that are super implementation specific (e.g. "move x11 detection to python configure"), but I think this work has a real user-perceptible bug that we should refer to instead.
Updated•3 years ago
|
Description
•