From 1ccfaedd0843f3e20bbcdd7d77925442e39e0123 Mon Sep 17 00:00:00 2001 From: Sarah Mei Date: Sat, 6 Aug 2011 18:19:17 -0700 Subject: [PATCH] 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. --- features/step_definitions/oauth_steps.rb | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/features/step_definitions/oauth_steps.rb b/features/step_definitions/oauth_steps.rb index 444648fc3..cfac7dd0b 100644 --- a/features/step_definitions/oauth_steps.rb +++ b/features/step_definitions/oauth_steps.rb @@ -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