Browse Source

Create socket and pipes in /run

master
Patrick Lühne 2 years ago
parent
commit
64278b6573
Signed by: patrick
GPG Key ID: 05F3611E97A70ABF
  1. 2
      github-fast-env/github-fast-env.rb
  2. 10
      github-fast-env/github-fast-envd.rb

2
github-fast-env/github-fast-env.rb vendored

@ -33,7 +33,7 @@ end
# TODO: support arguments
script_path = File.realpath(ARGV[0])
control_socket_path = "/tmp/github-fast-envd.sock"
control_socket_path = "/run/github-fast-env/github-fast-envd.sock"
$original_stdin = $stdin.dup
$original_stdout = $stdout.dup

10
github-fast-env/github-fast-envd.rb vendored

@ -29,7 +29,13 @@ $original_stdin = $stdin.dup
$original_stdout = $stdout.dup
$original_stderr = $stderr.dup
control_socket_path = "/tmp/github-fast-envd.sock"
$run_base_path = "/run/github-fast-env"
unless File.directory?($run_base_path)
FileUtils.mkdir_p($run_base_path, :mode => 0700)
end
control_socket_path = "#{$run_base_path}/github-fast-envd.sock"
if File.exist?(control_socket_path) and File.socket?(control_socket_path)
File.unlink(control_socket_path)
@ -87,7 +93,7 @@ def read_command(control_socket)
end
def set_up_named_pipes(control_socket, connection_id)
pipe_base_path = "/tmp/github-fast-envd.#{connection_id}"
pipe_base_path = "/#{$run_base_path}/github-fast-envd.#{connection_id}"
pipe_base_path_encoded = Base64.encode64(pipe_base_path).delete("\n")
stdin = open_pipe("#{pipe_base_path}.stdin")

Loading…
Cancel
Save