Skip to content

Commit

Permalink
Wait for pids
Browse files Browse the repository at this point in the history
  • Loading branch information
djmb committed Oct 11, 2023
1 parent 1ec10bd commit a019305
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
4 changes: 2 additions & 2 deletions test/integration/processes_lifecycle_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class ProcessLifecycleTest < ActiveSupport::TestCase
puts @pid
puts `ps aux | grep #{@pid}`

assert_not process_exists?(@pid)
assert_not process_exists?(@pid, waitpid: true)

assert_completed_job_results("no pause")
assert_job_status(no_pause, :finished)
Expand Down Expand Up @@ -70,7 +70,7 @@ class ProcessLifecycleTest < ActiveSupport::TestCase
signal_process(@pid, :QUIT, wait: 1.second)
wait_for_jobs_to_finish_for(5.seconds)

assert_not process_exists?(@pid)
assert_not process_exists?(@pid, waitpid: true)

assert_completed_job_results("no pause")
assert_job_status(no_pause, :finished)
Expand Down
3 changes: 2 additions & 1 deletion test/test_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,8 @@ def signal_process(pid, signal, wait: nil, raise_on_missing: true)
end
end

def process_exists?(pid)
def process_exists?(pid, waitpid: false)
Process.waitpid(pid) if waitpid
Process.getpgid(pid)
true
rescue Errno::ESRCH
Expand Down

0 comments on commit a019305

Please sign in to comment.