Skip to content

Commit

Permalink
Start server process in clean env, closes rails#456
Browse files Browse the repository at this point in the history
ENV["GEM_PATH"] was empty string, so GEM_PATH and GEM_HOME passed to
server process were same path.
It used to work before bundler 1.11.0 release cause bundler didn't clean
ENV["RUBYLIB"] and `require bundler/setup` was using that instead.
Change in bundler: rubygems/bundler#4002
  • Loading branch information
sonalkr132 committed Jan 23, 2016
1 parent 14b3ff3 commit 1d406ce
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions lib/spring/client/run.rb
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,14 @@ def run
def boot_server
env.socket_path.unlink if env.socket_path.exist?

pid = Process.spawn(
gem_env,
"ruby",
"-e", "gem 'spring', '#{Spring::VERSION}'; require 'spring/server'; Spring::Server.boot"
)
pid = nil
Bundler.with_clean_env do
pid = Process.spawn(
gem_env,
"ruby",
"-e", "gem 'spring', '#{Spring::VERSION}'; require 'spring/server'; Spring::Server.boot"
)
end

until env.socket_path.exist?
_, status = Process.waitpid2(pid, Process::WNOHANG)
Expand Down

0 comments on commit 1d406ce

Please sign in to comment.