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

Fix puma-wild handling a restart properly. Fixes #550

This commit is contained in:
Evan Phoenix 2014-10-29 17:07:25 -07:00
parent 1c28a30712
commit e44ced1d1f
2 changed files with 24 additions and 4 deletions

View file

@ -5,11 +5,25 @@
require 'rubygems' require 'rubygems'
deps = ARGV.shift.split(",").each do |s| gems = ARGV.shift
inc = ""
if gems == "-I"
inc = ARGV.shift
$LOAD_PATH.concat inc.split(":")
gems = ARGV.shift
end
gems.split(",").each do |s|
name, ver = s.split(":",2) name, ver = s.split(":",2)
gem name, ver gem name, ver
end end
module Puma; end
Puma.const_set("WILD_ARGS", ["-I", inc, gems])
require 'puma/cli' require 'puma/cli'
cli = Puma::CLI.new ARGV cli = Puma::CLI.new ARGV

View file

@ -363,7 +363,11 @@ module Puma
lib = File.expand_path "lib" lib = File.expand_path "lib"
arg0[1,0] = ["-I", lib] if $:[0] == lib arg0[1,0] = ["-I", lib] if $:[0] == lib
@restart_argv = arg0 + ARGV if defined? Puma::WILD_ARGS
@restart_argv = arg0 + Puma::WILD_ARGS + ARGV
else
@restart_argv = arg0 + ARGV
end
end end
end end
@ -431,6 +435,7 @@ module Puma
Dir.chdir @restart_dir Dir.chdir @restart_dir
argv += [redirects] unless RUBY_VERSION < '1.9' argv += [redirects] unless RUBY_VERSION < '1.9'
Kernel.exec(*argv) Kernel.exec(*argv)
end end
end end
@ -467,8 +472,9 @@ module Puma
wild = File.expand_path(File.join(puma_lib_dir, "../bin/puma-wild")) wild = File.expand_path(File.join(puma_lib_dir, "../bin/puma-wild"))
args = [Gem.ruby] + dirs.map { |x| ["-I", x] }.flatten + wild_loadpath = dirs.join(":")
[wild, deps] + @original_argv
args = [Gem.ruby] + [wild, "-I", wild_loadpath, deps] + @original_argv
Kernel.exec(*args) Kernel.exec(*args)
end end