[Groonga-commit] ranguba/chupa-text at 56b996f [master] Ensure killing external command

アーカイブの一覧に戻る
Kouhei Sutou null+****@clear*****
Mon Mar 4 06:15:11 JST 2019


Kouhei Sutou	2019-03-04 06:15:11 +0900 (Mon, 04 Mar 2019)

  Revision: 56b996f5a8ff74d416f96b894183f093d7c06b47
  https://github.com/ranguba/chupa-text/commit/56b996f5a8ff74d416f96b894183f093d7c06b47

  Message:
    Ensure killing external command

  Modified files:
    lib/chupa-text/external-command.rb

  Modified: lib/chupa-text/external-command.rb (+12 -1)
===================================================================
--- lib/chupa-text/external-command.rb    2019-03-03 07:42:02 +0900 (97530b9)
+++ lib/chupa-text/external-command.rb    2019-03-04 06:15:11 +0900 (aff2e04)
@@ -37,7 +37,18 @@ module ChupaText
                   @path.to_s,
                   *arguments,
                   spawn_options(options[:spawn_options]))
-      status = wait_process(pid, options[:timeout])
+      status = nil
+      begin
+        status = wait_process(pid, options[:timeout])
+      ensure
+        unless status
+          begin
+            Process.kill(:KILL, pid)
+            Process.waitpid(pid)
+          rescue SystemCallError
+          end
+        end
+      end
       status.success?
     end
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.osdn.me/mailman/archives/groonga-commit/attachments/20190304/8097b938/attachment.html>


More information about the Groonga-commit mailing list
アーカイブの一覧に戻る