Method: RunLoop::ProcessWaiter#wait_for_none
- Defined in:
- lib/run_loop/process_waiter.rb
#wait_for_none ⇒ Object
Wait for all ‘process_name` to finish.
116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 |
# File 'lib/run_loop/process_waiter.rb', line 116 def wait_for_none return true if !running_process? now = Time.now poll_until = now + @options[:timeout] delay = @options[:interval] has_terminated = false while Time.now < poll_until has_terminated = !self.running_process? break if has_terminated sleep delay end RunLoop.log_debug("Waited for #{Time.now - now} seconds for '#{process_name}' to die.") if @options[:raise_on_timeout] and !has_terminated raise "Waited #{@options[:timeout]} seconds for '#{process_name}' to die." end has_terminated end |