def connect_to_passenger_admin_socket(options)
return @server_instance.connect(options)
rescue AdminTools::ServerInstance::RoleDeniedError
PhusionPassenger.require_passenger_lib 'platform_info/ruby'
STDERR.puts "*** ERROR: You are not authorized to query the status for " +
"this #{PROGRAM_NAME} instance. Please try again with '#{PlatformInfo.ruby_sudo_command}'."
exit 2
rescue AdminTools::ServerInstance::CorruptedDirectoryError
STDERR.puts "*** ERROR: The server instance directory #{server_instance.path} is corrupted. " +
"This could have two causes:\n" +
"\n" +
" 1. The #{PROGRAM_NAME} instance is no longer running, but it failed to cleanup the directory. " +
"Please delete this directory and ignore the problem.\n" +
" 2. An external program corrupted the directory. Please restart this #{PROGRAM_NAME} instance.\n"
exit 2
end