Handle connection errors gracefully

This commit is contained in:
Patrick Lühne 2020-05-26 03:07:50 +02:00
parent 51b81a7bf8
commit 02e03156ab
Signed by: patrick
GPG Key ID: 05F3611E97A70ABF

View File

@ -35,8 +35,6 @@ script_path = File.realpath(ARGV[0])
control_socket_path = "/tmp/github-fast-envd.sock"
$control_socket = UNIXSocket.new(control_socket_path)
$original_stdin = $stdin.dup
$original_stdout = $stdout.dup
$original_stderr = $stderr.dup
@ -47,6 +45,13 @@ def log(level, message)
end
end
begin
$control_socket = UNIXSocket.new(control_socket_path)
rescue StandardError => error
log "error", "could not connect to github-fast-envd socket"
exit 1
end
$remote_process_id = nil
Signal.trap("HUP") do