From: Jim Hranicky Date: 2008-02-06T22:55:53+09:00 Subject: Re: Timeout::Error Jeremy Thurgood wrote: >> No. The exception would be rescued inappropriately then. > > At the moment it's being /not/ rescued inappropriately. Why should a > timeout exception (from within the standard libraries!) evade a naked > "rescue"? The current situation requires me to figure out everythign > that can possibly time out and add special-case error handling for it. > Worse than this, irb doesn't catch Timeout::Error and thus kills my > session (which typically has a bunch of state in it) whenever the http > server I'm talking to takes a while to respond. While I tend to agree and ran into the same frustration as you, you can specify the type of exception Timeout throws like so: timeout(5, StandardError) { ... } which seems to do what's desired, ruby -rtimeout -e 'begin ; timeout(5, StandardError) { while true; sleep 1; end }; \ rescue; puts "rescued" ; end' Jim