[Groonga-commit] groonga/grntest at 55358a8 [master] Stop to wait finishing process forever

Back to archive index

Kouhei Sutou null+****@clear*****
Mon Aug 19 14:52:07 JST 2013


Kouhei Sutou	2013-08-19 14:52:07 +0900 (Mon, 19 Aug 2013)

  New Revision: 55358a8a6274da79b4dc237926cf753b4fca6350
  https://github.com/groonga/grntest/commit/55358a8a6274da79b4dc237926cf753b4fca6350

  Message:
    Stop to wait finishing process forever

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

  Modified: lib/grntest/test-runner.rb (+15 -1)
===================================================================
--- lib/grntest/test-runner.rb    2013-08-19 14:32:21 +0900 (937d980)
+++ lib/grntest/test-runner.rb    2013-08-19 14:52:07 +0900 (df44a24)
@@ -303,7 +303,21 @@ EOC
           wait_groonga_http_shutdown(pid_file_path)
         end
       ensure
-        Process.waitpid(pid) if pid
+        ensure_process_finished(pid)
+      end
+    end
+
+    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 > 10
+        Process.kill(pid, :TERM)
+        sleep(0.1)
       end
     end
 
-------------- next part --------------
HTML����������������������������...
Download 



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