← index #3356Issue #1293
Related · high · value 1.735
QUERY · ISSUE

[baremetal] sys.stdin does not handle ctrl-D EOF markers

openby dhalbertopened 2017-10-07updated 2017-10-21

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

esp8266: can't read from sys.stdin

closedby deshipuopened 2015-05-28updated 2016-05-06
ports

I was trying to work around the fact that the ESP8266 port doesn't have UART support on the Python side yet, and simply read/write from and to the sys.stdin and sys.stdout.

While sys.stdout works as expected, trying to read even a single character from sys.stdin hangs the REPL. I compared with other ports, and that's not the case in them -- they wait until the specified number of characters is input and then properly return those characters.

Keyboard

j / / n
next pair
k / / p
previous pair
1 / / h
show query pane
2 / / l
show candidate pane
c
copy suggested comment
r
toggle reasoning
g i
go to index
?
show this help
esc
close overlays

press ? or esc to close

copied