From 65df9d8fccc11b1318867a89802a7639d4175255 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrick=20L=C3=BChne?= Date: Tue, 26 May 2020 04:01:52 +0200 Subject: [PATCH] Move preloaded modules to separate file --- Cargo.toml | 1 + github-fast-env/github-fast-envd.rb | 6 ++---- github-fast-env/preload.rb | 5 +++++ 3 files changed, 8 insertions(+), 4 deletions(-) create mode 100644 github-fast-env/preload.rb diff --git a/Cargo.toml b/Cargo.toml index 635551a..c8900c3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,6 +9,7 @@ edition = "2018" assets = [ ["github-fast-env/github-fast-envd.rb", "usr/bin/github-fast-envd", "755"], ["github-fast-env/github-fast-env.rb", "usr/bin/github-fast-env", "755"], + ["github-fast-env/preload.rb", "usr/lib/github-fast-env/", "755"], ["github-fast-env/systemd/github-fast-envd.service", "usr/lib/systemd/system/", "644"], ["ghe-fast-tools/ghe-fast-console.rb", "usr/lib/ghe-fast-tools/", "644"], ["ghe-fast-tools/bin/ghe-fast-console.rb", "usr/bin/ghe-fast-console", "755"], diff --git a/github-fast-env/github-fast-envd.rb b/github-fast-env/github-fast-envd.rb index 8bfa8eb..6e557ab 100644 --- a/github-fast-env/github-fast-envd.rb +++ b/github-fast-env/github-fast-envd.rb @@ -4,10 +4,6 @@ require "base64" require "io/console" require "socket" -require "/data/github/current/config/environment" -require "irb" -require "irb/completion" - class ClientError < StandardError def initialize(message) super(message) @@ -154,6 +150,8 @@ def set_up_pseudoterminal(control_socket, pseudoterminal_path) control_socket.puts "ready" end +load "/usr/lib/github-fast-env/preload.rb" + while true control_socket = control_server.accept $original_stderr.puts "- new connection" diff --git a/github-fast-env/preload.rb b/github-fast-env/preload.rb new file mode 100644 index 0000000..6adfbf3 --- /dev/null +++ b/github-fast-env/preload.rb @@ -0,0 +1,5 @@ +#!/usr/bin/env ruby + +require "/data/github/current/config/environment" +require "irb" +require "irb/completion"