def select_passenger_instance
if pid = @options[:instance]
@server_instance = AdminTools::ServerInstance.for_pid(pid)
if !@server_instance
puts "*** ERROR: there doesn't seem to be a #{PROGRAM_NAME} instance running on PID #{pid}."
list_all_passenger_instances(AdminTools::ServerInstance.list)
puts
puts "Please pass `--instance <#{PROGRAM_NAME}> PID>` to select a specific #{PROGRAM_NAME} instance."
abort
end
else
server_instances = AdminTools::ServerInstance.list
if server_instances.empty?
abort "*** ERROR: #{PROGRAM_NAME} doesn't seem to be running."
elsif server_instances.size == 1
@server_instance = server_instances.first
else
complain_that_multiple_passenger_instances_are_running(server_instances)
abort
end
end
end