python-coloredlogs icon indicating copy to clipboard operation
python-coloredlogs copied to clipboard

Strange coloring failure with a subprocess call

Open rlaphoenix opened this issue 3 years ago • 1 comments

If I make a subprocess call (of any kind, Popen, run, check_call, check_output, e.t.c) it will break the coloring of every single further log.

Windows Terminal: Windows Terminal

PyCharm: PyCharm

You can see that I added test1 and test2 logs before and after the subprocess call and only test2 broke.

I have no idea why this is happening. I've also tried run() with stdout and stderr redirected to subprocess.DEVNULL, and it still happens.

The relevant line of code can be found here:

https://github.com/rlaphoenix/nton/blob/ccf9dbfcbb5ea25849733630173e96bf27062132/nton/main.py#L220

rlaphoenix avatar Nov 12 '22 09:11 rlaphoenix

A member of TPH has given me a tip of using os.system("") and it did in fact work. But why is the question? Seems he also needed to use this a few times as well.

Likely relevant issue: https://github.com/python/cpython/issues/84315

rlaphoenix avatar Nov 12 '22 10:11 rlaphoenix