Method: God::CLI::Command#terminate_command

Defined in:
lib/god/cli/command.rb

#terminate_commandObject



142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
# File 'lib/god/cli/command.rb', line 142

def terminate_command
  t = Thread.new { loop { STDOUT.print('.'); STDOUT.flush; sleep(1) } }
  if @server.stop_all
    t.kill; STDOUT.puts
    puts 'Stopped all watches'
  else
    t.kill; STDOUT.puts
    puts 'Could not stop all watches within 10 seconds'
  end
  
  begin
    @server.terminate
    abort 'Could not stop god'
  rescue DRb::DRbConnError
    puts 'Stopped god'
  end
end