Skip to content
This repository was archived by the owner on Nov 30, 2024. It is now read-only.

Commit 0427b36

Browse files
committed
Search Ruby processes. Avoid infinite while loop on Ubuntu
1 parent 85ca9d9 commit 0427b36

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

spec/integration/bisect_spec.rb

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,17 @@ def bisect(cli_args, expected_status=nil)
4545
it 'does not leave zombie processes', :unless => RSpec::Support::OS.windows? do
4646
original_pids = pids()
4747
bisect(%W[spec/rspec/core/resources/blocking_pipe_bisect_spec.rb_], 1)
48-
sleep 0.1 while ((extra_pids = pids() - original_pids).join =~ /[RE]/i)
48+
while ((extra_pids = pids() - original_pids).join =~ /[RE]/i)
49+
sleep 0.1
50+
end
4951
expect(extra_pids.join).to_not include "Z"
5052
end
5153
end
5254

5355
def pids
54-
%x[ps -ho pid,state].split("\n").map { |line| line.split(/\s+/).compact.join(' ') }
56+
%x[ps -ho pid,state,cmd | grep "[r]uby"].split("\n").map do |line|
57+
line.split(/\s+/).compact.join(' ')
58+
end
5559
end
5660
end
5761
end

0 commit comments

Comments
 (0)