These are blocking. If there is nothing, they wait.
Interestingly, run them on the toplevel followed by CTRL-D
A control signals an EOF condition in standard mode, and we see -1:
?- peek_code(X). ^DX = -1.
But in raw mode:
?- with_tty_raw(peek_code(X)). X = 4.
ASCII 4 is "end of transmission". The EOT character is received instead of the EOF condition being signaled.
See https://en.wikipedia.org/wiki/End-of-Transmission_character