I would like to detect whether there is input on stdin
in a short time window, and continue execution either way, with the outcome stored in a Bool
. (My real goal is to implement a pause button on a simulation that runs in the terminal. A second keypress should unpause the program, and it should continue executing.) I have tried to use poll_fd
but it does not work on stdin
:
julia> FileWatching.poll_fd(stdin, readable=true)
ERROR: MethodError: no method matching poll_fd(::Base.TTY; readable=true)
Is there a way that will work on julia? I have found a solution that works in python, and I have considered using this via PyCall, but I am looking for
- a cleaner, pure-julia way; and
- a way that does not fight or potentially interfere with julia's use of libuv.