Skip to content

Commit

Permalink
Make sure no error is raised when a process is already terminated (#939)
Browse files Browse the repository at this point in the history
  • Loading branch information
louim committed Mar 5, 2024
1 parent 24f150c commit a0373af
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/parallel_tests.rb
Expand Up @@ -44,6 +44,8 @@ def pid_file_path

def stop_all_processes
pids.all.each { |pid| Process.kill(:INT, pid) }
rescue Errno::ESRCH
# Process already terminated, do nothing
end

# copied from http://github.com/carlhuda/bundler Bundler::SharedHelpers#find_gemfile
Expand Down
7 changes: 7 additions & 0 deletions spec/parallel_tests_spec.rb
Expand Up @@ -194,6 +194,13 @@ def with_running_processes(count, wait = 0.2)
expect(ParallelTests.pids.count).to eq(0)
end
end

it "doesn't fail if the pid has already been killed", unless: Gem.win_platform? do
ParallelTests.with_pid_file do
ParallelTests.pids.add(1234)
expect { ParallelTests.stop_all_processes }.not_to raise_error
end
end
end

it "has a version" do
Expand Down

0 comments on commit a0373af

Please sign in to comment.