diff --git a/github-fast-env/github-fast-envd.rb b/github-fast-env/github-fast-envd.rb index a0d1718..8bfa8eb 100644 --- a/github-fast-env/github-fast-envd.rb +++ b/github-fast-env/github-fast-envd.rb @@ -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!