Clean up named pipes

This commit is contained in:
Patrick Lühne 2020-05-26 03:51:22 +02:00
parent 64278b6573
commit 519c05d9c9
Signed by: patrick
GPG Key ID: 05F3611E97A70ABF

View File

@ -126,6 +126,20 @@ def set_up_named_pipes(control_socket, connection_id)
$stderr.reopen(stderr)
end
def clean_up_named_pipes(control_socket, connection_id)
pipe_base_path = "/#{$run_base_path}/github-fast-envd.#{connection_id}"
if File.exist?("#{pipe_base_path}.stdin")
File.delete("#{pipe_base_path}.stdin")
end
if File.exist?("#{pipe_base_path}.stdout")
File.delete("#{pipe_base_path}.stdout")
end
if File.exist?("#{pipe_base_path}.stderr")
File.delete("#{pipe_base_path}.stderr")
end
end
def set_up_pseudoterminal(control_socket, pseudoterminal_path)
pseudoterminal_io = File.open(pseudoterminal_path, File::RDWR | File::NOCTTY)
@ -235,6 +249,10 @@ while true
end
control_socket.close
if mode == "named-pipes"
clean_up_named_pipes(control_socket, connection_id)
end
$original_stderr.puts " finished handling request (#{process_id})"
Kernel.exit!