QUERY · ISSUE
[baremetal] sys.stdin does not handle ctrl-D EOF markers
sys.stdin.read(), sys.stdin.readlines(), etc. do not handle ctrl-D at the beginning of a line as EOF (except on ports like unix). So for instance, there's no way to terminate input when doing sys.stdin.readlines().
Is this something that should mimic CPython on an OS-less port? Some lower-level stream read routine could check if the stream was sys.stdin and handle ctrl-D specially.
(tested on esp8266 port)
CANDIDATE · ISSUE
On RP2 sys.stdin.read(64) and sys.stdin.readline() do not work if we have multiple of 64 bytes in buffer
port-rp2
MicroPython v1.19.1-994-ga4672149b on 2023-03-29; Raspberry Pi Pico with RP2040
Pico code:
import sys
while True:
line = sys.stdin.read(64)
print(len(line))