Bug report
Bug description:
proc = subprocess.Popen(
['bash', '-c', 'sleep 10; echo hello'],
stdout=subprocess.PIPE,
text=True
)
os.set_blocking(proc.stdout.fileno(), False)
print(repr(proc.stdout.read(8192)))
Refer to issue #57531 for discussion on what should happen in general, but I'm filing this to point out that when text=True the output is an empty string (indistinguishable from EOF, which is a problem), and when text=False the result is None (while an empty string is produced only on EOF).
They should probably behave consistently, and also EOF should be distinguishable from no-data-yet; making the binary behaviour preferable.
CPython versions tested on:
3.13
Operating systems tested on:
Linux
Bug report
Bug description:
Refer to issue #57531 for discussion on what should happen in general, but I'm filing this to point out that when
text=Truethe output is an empty string (indistinguishable from EOF, which is a problem), and whentext=Falsethe result isNone(while an empty string is produced only on EOF).They should probably behave consistently, and also EOF should be distinguishable from no-data-yet; making the binary behaviour preferable.
CPython versions tested on:
3.13
Operating systems tested on:
Linux