[Groonga-commit] groonga/grntest at f566bea [master] Try SIGKILL if SIGTERM can't kill process

Back to archive index

Kouhei Sutou null+****@clear*****
Wed May 18 11:48:35 JST 2016


Kouhei Sutou	2016-05-18 11:48:35 +0900 (Wed, 18 May 2016)

  New Revision: f566beabb0bd105eb3479eb935338ff77bfb8913
  https://github.com/groonga/grntest/commit/f566beabb0bd105eb3479eb935338ff77bfb8913

  Message:
    Try SIGKILL if SIGTERM can't kill process

  Modified files:
    lib/grntest/test-runner.rb

  Modified: lib/grntest/test-runner.rb (+14 -8)
===================================================================
--- lib/grntest/test-runner.rb    2016-05-18 10:11:25 +0900 (ba5a02f)
+++ lib/grntest/test-runner.rb    2016-05-18 11:48:35 +0900 (a5b3abd)
@@ -381,14 +381,20 @@ call chdir("#{context.temporary_directory_path}")
     def ensure_process_finished(pid)
       return if pid.nil?
 
-      n_retries = 0
-      loop do
-        finished_pid = Process.waitpid(pid, Process::WNOHANG)
-        break if finished_pid
-        n_retries += 1
-        break if n_retries > 100
-        Process.kill(:TERM, pid)
-        sleep(0.1)
+      [:TERM, :KILL].each do |signal|
+        n_retries = 0
+        loop do
+          finished_pid = Process.waitpid(pid, Process::WNOHANG)
+          return if finished_pid
+          n_retries += 1
+          return if n_retries > 100
+          begin
+            Process.kill(signal, pid)
+          rescue SystemCallError
+            $stderr.puts("#{signal} -> #{pid}: #{$!.class}: #{$!}")
+          end
+          sleep(0.1)
+        end
       end
     end
 
-------------- next part --------------
HTML����������������������������...
Download 



More information about the Groonga-commit mailing list
Back to archive index