From: james.d.masters@... Date: 2007-04-15T16:05:08+09:00 Subject: Re: executing a system command and stopping it after a specified duration? On Apr 14, 9:57 pm, Robert La Ferla wrote: > I'd like to run a system command and then stop it after specified > amount of time (in seconds or milliseconds.) What's the best way to > do it? In Perl it was done by setting the signal ALRM (or using the "alarm" command). I'm not sure how this is done in Ruby as I haven't had a use for signal trapping since using Ruby. > Also, if there is a better Ruby way to do this other than "cat", I'm > all ears... # assuming binary file (i.e. mpg) File.open("/dev/video", "rb") do |inf| File.open("test.mpg", "wb") do |outf| inf.each_byte {|byte| outf.putc byte} end end