1
0
Fork 0
mirror of https://github.com/puma/puma.git synced 2022-11-09 13:48:40 -05:00

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.)
This commit is contained in:
Per Lundberg 2017-11-16 22:26:31 +01:00 committed by Nate Berkopec
parent 42b74d4f45
commit ac7106e96d

View file

@ -168,7 +168,7 @@ module Puma
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