lib/selenium/webdriver/common/child_process.rb in selenium-webdriver-4.20.1 vs lib/selenium/webdriver/common/child_process.rb in selenium-webdriver-4.22.0
- old
+ new
@@ -82,11 +82,11 @@
def exited?
return false unless @pid
WebDriver.logger.debug("Checking if #{@pid} is exited:", id: :process)
- _, @status = Process.waitpid2(@pid, Process::WNOHANG | Process::WUNTRACED) if @status.nil?
+ _, @status = waitpid2(@pid, Process::WNOHANG | Process::WUNTRACED) if @status.nil?
return false if @status.nil?
exit_code = @status.exitstatus || @status.termsig
WebDriver.logger.debug(" -> exit code is #{exit_code.inspect}", id: :process)
@@ -103,11 +103,11 @@
end
def wait
return if exited?
- _, @status = Process.waitpid2(@pid)
+ _, @status = waitpid2(@pid)
end
private
def terminate(pid)
@@ -115,9 +115,15 @@
end
def kill(pid)
Process.kill(SIGKILL, pid)
rescue Errno::ECHILD, Errno::ESRCH
+ # already dead
+ end
+
+ def waitpid2(pid, flags = 0)
+ Process.waitpid2(pid, flags)
+ rescue Errno::ECHILD
# already dead
end
end # ChildProcess
end # WebDriver
end # Selenium