Is there a way to drain STDIN by reading characters in non-blocking mode?

you may also want to check with_tty_raw/1, as pointed out by Jan here:

1 Like