From: "S. Robert James" Date: 2006-11-01T10:30:09+09:00 Subject: Re: Nonblocking IO read Not very attractive... Back to the original question: there is no simple way to read nonblocking, or see if any output is available ?!?! ara.t.howard@noaa.gov wrote: > On Wed, 1 Nov 2006 srobertjames@gmail.com wrote: > > > I'm running an external command (using popen4 - yes, it is available on > > Windows also). I capture stdout and stderr. "what will your program do if > > there is no input?" - I assume you mean output - Well, I hope there is no > > stderr output. If there is, I'd like to capture it and feed it to Logger. > > > > Likewise, if there is a problem, and there's no stdout, then I don't want to > > wait for ever - I want to throw an exception. > > so, basically you want to timeout on a read right? in unix you can just use > > require 'timeout' > > Timeout::timeout(n) do > Open4.popen4 ... > ... > ... > end > > but, this is implimented via a thread so i think the read is going to block > your entire process in windows... you might try it. > > -a > -- > my religion is very simple. my religion is kindness. -- the dalai lama