Chubbies actually shuts itself down now, so both builds should now be able to be green at the same time. FWIW, @ variables in class methods are class variables and therefore persist across tests.

This commit is contained in:
Sarah Mei 2011-08-06 18:19:17 -07:00
parent ffb6b18ce8
commit 1ccfaedd08

View file

@ -76,14 +76,12 @@ class Chubbies
end
def self.kill
`kill -9 #{get_pid}`
pid = self.get_pid
`kill -9 #{pid}` if pid.present?
end
def self.ensure_killed
if !(@killed) && self.running?
self.kill
@killed = true
end
self.kill if self.running?
end
def self.running?
@ -103,10 +101,12 @@ class Chubbies
end
def self.get_pid
@pid ||= lambda {
processes = `ps ax -o pid,command | grep "#{run_command}"`.split("\n")
processes = processes.select{|p| !p.include?("grep") }
processes = `ps ax -o pid,command | grep "#{run_command}"`.split("\n")
processes = processes.select{|p| !p.include?("grep") }
if processes.any?
processes.first.split(" ").first
}.call
else
nil
end
end
end