[docs] [issue22865] Document how to make pty.spawn not copy data

Martin Panter report at bugs.python.org
Wed Oct 7 03:51:04 CEST 2015

Martin Panter added the comment:

If you return null bytes, they will be written to the parent process’s stdout file descriptor, rather than being ignored. I do not think it is possible to ignore output with the spawn() API, unless perhaps you previously set up stdout write to /dev/null or similar.

Do you have a reference for your fact about terminals ignoring null input bytes? I’m skeptical because a basic serial terminal can send arbitrary data including nulls, but I am not so familiar with pseudo-terminals.

However the bit about interpreting an empty string could be useful. I would drop the “or any falsey value”; is that a typo? I suspect that the functions have to return byte strings (not text). It would be nice to say what the consequences of the EOF condition is, e.g. I can see for the child’s output it would stop copying, but not actually close the parent’s stdout to signal EOF. What about in the other direction? Can you signal multiple EOFs with data in between?

nosy: +martin.panter
stage:  -> patch review
versions:  -Python 3.2, Python 3.3

Python tracker <report at bugs.python.org>

More information about the docs mailing list