S
Stephen Ware
Hi guys, sorry if this is a stupid question, but I've been reading
around online and in 'Programming Ruby,' and I can't find anything.
Is there a way to perform a non-blocking gets or getc? As in a method
that reads a character from stdin if there is one in the buffer or
returns nil otherwise? I'm writing a multi-threaded application that
communicates over the internet using sockets, but I want the person who
runs the script on the host machine to be able to enter commands via
stdin. The 'gets' command hangs all my threads until it returns.
Any suggestions? Thanks!
-Stephen
around online and in 'Programming Ruby,' and I can't find anything.
Is there a way to perform a non-blocking gets or getc? As in a method
that reads a character from stdin if there is one in the buffer or
returns nil otherwise? I'm writing a multi-threaded application that
communicates over the internet using sockets, but I want the person who
runs the script on the host machine to be able to enter commands via
stdin. The 'gets' command hangs all my threads until it returns.
Any suggestions? Thanks!
-Stephen