From: greg Date: 2006-09-29T22:01:17+09:00 Subject: Re: how to determine if pipe is given small typo there, this is better... require 'thread' input = nil t = Thread.new() do input = STDIN.readlines end # do some stuff # parse some options while t.alive? old = input puts "collecting input..." if old puts "thread running for 1 second" Kernel.sleep(1) if old == input if input puts "done collecting input" else puts "no input found on STDIN" end Kernel.sleep(1) t.kill break end end puts input