How can I make a clojure program block until a key is pressed?
I want the equivalent behaviour of a blocking read from stdin in other languages.
How can I make a clojure program block until a key is pressed?
I want the equivalent behaviour of a blocking read from stdin in other languages.
The easiest way is to use ConsoleReader from JLine.
See the Clojure Cookbook for details: https://github.com/clojure-cookbook/clojure-cookbook/blob/master/04_local-io/4-02_read-unbuffered-keystroke.asciidoc
The question in JohnJ's comment (Reading unbuffered keyboard input in Clojure) gives a very similar example to the one in the Cookbook.