From ac7106e96d70c87c70cf58ce4312acb045845a01 Mon Sep 17 00:00:00 2001 From: Per Lundberg Date: Thu, 16 Nov 2017 22:26:31 +0100 Subject: [PATCH] Puma::Launcher: avoid a leading space character in RUBYOPT (#1455) The problem is this: ``` 2.4.2 :001 > [nil, 'foo'].join(' ') => " foo" ``` Note the leading space character. By `lstrip`:ing the result of the join, we avoid this altogether. (This is a fix for the underlying problem that triggered https://github.com/jruby/jruby/issues/4849.) --- lib/puma/launcher.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/puma/launcher.rb b/lib/puma/launcher.rb index 99af2e03ee..cbf477a934 100644 --- a/lib/puma/launcher.rb +++ b/lib/puma/launcher.rb @@ -168,7 +168,7 @@ def run env = Bundler::ORIGINAL_ENV.dup # add -rbundler/setup so we load from Gemfile when restarting bundle = "-rbundler/setup" - env["RUBYOPT"] = [env["RUBYOPT"], bundle].join(" ") unless env["RUBYOPT"].to_s.include?(bundle) + env["RUBYOPT"] = [env["RUBYOPT"], bundle].join(" ").lstrip unless env["RUBYOPT"].to_s.include?(bundle) env else ENV.to_h