From: 7stud -- Date: 2007-10-04T05:55:43+09:00 Subject: Re: Non-blocking 'gets' ? Stephen Ware wrote: > 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. > If you don't wait for the user to input something, how can there ever be input in a buffer? -- Posted via http://www.ruby-forum.com/.