require 'timeout' Timeout.timeout(0.5) do begin sleep 1 rescue Exception => ex puts ex.inspect puts 'ಠ_ಠ' end end Timeout.timeout(0.5) do begin sleep 1 rescue => ex puts ex.inspect end end