[Groonga-commit] groonga/grntest [master] Use IO.pipe with block

Back to archive index

null+****@clear***** null+****@clear*****
2012年 8月 8日 (水) 16:08:07 JST


Kouhei Sutou	2012-08-08 16:08:07 +0900 (Wed, 08 Aug 2012)

  New Revision: 0e5fb82e0012d9f439bdf92191b56e492139d075
  https://github.com/groonga/grntest/commit/0e5fb82e0012d9f439bdf92191b56e492139d075

  Log:
    Use IO.pipe with block

  Modified files:
    lib/groonga/tester.rb

  Modified: lib/groonga/tester.rb (+3 -13)
===================================================================
--- lib/groonga/tester.rb    2012-08-08 15:18:48 +0900 (330d558)
+++ lib/groonga/tester.rb    2012-08-08 16:08:07 +0900 (68e0e43)
@@ -413,19 +413,9 @@ module Groonga
       end
 
       def open_pipe
-        read = 0
-        write = 1
-
-        begin
-          input_pipe = IO.pipe
-          output_pipe = IO.pipe
-          yield(input_pipe[read], input_pipe[write],
-                output_pipe[read], output_pipe[write])
-        ensure
-          input_pipe ||= []
-          output_pipe ||= []
-          (input_pipe + output_pipe).each do |io|
-            io.close unless io.closed?
+        IO.pipe do |input_read, input_write|
+          IO.pipe do |output_read, output_write|
+            yield(input_read, input_write, output_read, output_write)
           end
         end
       end
-------------- next part --------------
HTML$B$NE:IU%U%!%$%k$rJ]4I$7$^$7$?(B...
Download 



Groonga-commit メーリングリストの案内
Back to archive index