[issue44709] [3.7] Popen Control Characters in stdout affect shell session

San report at bugs.python.org
Fri Jul 23 04:36:52 EDT 2021


San <elias.haag at web.de> added the comment:

I get your point. But I thought setting 'stdout=PIPE' should not send the stdout directly to the terminal but rather through the pipe first?!

Also what you're saying seems to contradict that this doesn't happen if I don't set the encoding and let it be a byte-stream. In that case you get the full byte-stream without any control-characters being executed.

In my opinion it is unintuitive that this is happening. 

For instance if I open a file using io, that contains the same control characters like so:
f = open('cc.txt', 'r', encoding='latin_1')

Then gladly this doesn't happen and the control chars get escaped using \x1b which is what I would also expect to happen when using Popen.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue44709>
_______________________________________


More information about the Python-bugs-list mailing list