Class: VagrantFoodtasterServer::ServerCommand

Inherits:
Object
  • Object
show all
Defined in:
lib/vagrant-foodtaster-server/server_command.rb

Instance Method Summary collapse

Instance Method Details

#executeObject



6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/vagrant-foodtaster-server/server_command.rb', line 6

def execute
  argv = parse_options

  port_number = argv.size == 0 ? 35672 : argv[0].to_i
  DRb.start_service "druby://localhost:#{port_number}", VagrantFoodtasterServer::Server.new(@app, @env)
  DRb.thread.join

rescue RuntimeError, Errno::EADDRINUSE => e
  write_formatted_exception_message(e)
rescue Interrupt
  DRb.stop_service
end