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

fixed cwd problem

git-svn-id: svn+ssh://rubyforge.org/var/svn/mongrel/trunk@539 19e92222-5c0b-0410-8929-a290d50e31e9
This commit is contained in:
bktaylor 2007-07-10 19:42:59 +00:00
parent 06d3905f87
commit 0d24e94cc7
2 changed files with 26 additions and 12 deletions

View file

@ -15,7 +15,7 @@ setup_rdoc ['README', 'LICENSE', 'COPYING', 'lib/**/*.rb', 'doc/**/*.rdoc']
desc "Does a full compile, test run"
task :default => [:test, :package]
version="1.0.1.1"
version="1.0.2"
name="mongrel_cluster"
setup_gem(name, version) do |spec|
@ -49,6 +49,6 @@ task :gem_source do
rm_rf "pkg/#{name}-#{version}"
sh %{ generate_yaml_index.rb -d pkg }
sh %{ scp -r pkg/* #{ENV['SSH_USER']}@rubyforge.org:/var/www/gforge-projects/railsmachine/releases/ }
sh %{ scp -r pkg/* #{ENV['SSH_USER']}@rubyforge.org:/var/www/gforge-projects/mongrel/releases/ }
end

View file

@ -75,10 +75,10 @@ module Cluster
argv << "--group #{@options["group"]}" if @options["group"]
argv << "--prefix #{@options["prefix"]}" if @options["prefix"]
cmd = argv.join " "
@ports.each do |port|
pid_file = port_pid_file(port)
if @clean && pid_file_exists?(port) && !check_process(port)
@ports.each do |port|
if @clean && pid_file_exists?(port) && !check_process(port)
pid_file = port_pid_file(port)
log "missing process: removing #{pid_file}"
File.unlink(pid_file)
end
@ -130,9 +130,8 @@ module Cluster
def status
read_options
Dir.chdir @options["cwd"] if @options["cwd"]
status = STATUS_OK
@ports.each do |port|
pid = check_process(port)
unless pid_file_exists?(port)
@ -149,13 +148,17 @@ module Cluster
end
puts ""
end
return status
end
def pid_file_exists?(port)
pid_file = port_pid_file(port)
File.exists?(pid_file)
pid_file = port_pid_file(port)
exists = false
chdir_cwd do
exists = File.exists?(pid_file)
end
exists
end
def check_process(port)
@ -173,9 +176,20 @@ module Cluster
RUBY_PLATFORM =~ /solaris/i ? "args" : "command"
end
def chdir_cwd
pwd = Dir.pwd
Dir.chdir(@options["cwd"]) if @options["cwd"]
yield
Dir.chdir(pwd) if @options["cwd"]
end
def read_pid(port)
pid_file = port_pid_file(port)
pid = File.read(pid_file)
pid = 0
chdir_cwd do
pid = File.read(pid_file)
end
return pid
end
def find_pid(port)