lib/dcmgr/helpers/cli_helper.rb in wakame-vdc-agents-11.06.0 vs lib/dcmgr/helpers/cli_helper.rb in wakame-vdc-agents-11.12.0

- old
+ new

@@ -14,13 +14,17 @@ timedout = false curthread = Thread.current timersig = EventMachine.add_timer(opts[:timeout]) { timedout = true - if curthread + if curthread && curthread.alive? curthread.raise(TimeoutError.new("timeout")) - curthread.pass + begin + curthread.pass + rescue ::Exception => e + # any thread errors can be ignored. + end end } count = opts[:retry] begin @@ -33,10 +37,9 @@ if respond_to?(:logger) logger.debug("Caught Error. To be retrying....: #{e}") end retry if (count -= 1) >= 0 ensure - curthread = nil EventMachine.cancel_timer(timersig) rescue nil end end class CommandError < StandardError