[Groonga-commit] groonga/groonga-query-log at 18417da [master] server-verifier: fix a bug that existing output is removed for tar.gz

Back to archive index

Kouhei Sutou null+****@clear*****
Tue Oct 9 14:36:23 JST 2018


Kouhei Sutou	2018-10-09 14:36:23 +0900 (Tue, 09 Oct 2018)

  Revision: 18417dacc86dbf52edd62016e2db759f5c399f2a
  https://github.com/groonga/groonga-query-log/commit/18417dacc86dbf52edd62016e2db759f5c399f2a

  Message:
    server-verifier: fix a bug that existing output is removed for tar.gz

  Modified files:
    lib/groonga-query-log/server-verifier.rb

  Modified: lib/groonga-query-log/server-verifier.rb (+11 -4)
===================================================================
--- lib/groonga-query-log/server-verifier.rb    2018-10-01 16:51:31 +0900 (43b24ad)
+++ lib/groonga-query-log/server-verifier.rb    2018-10-09 14:36:23 +0900 (9944418)
@@ -119,7 +119,7 @@ module GroongaQueryLog
 
     def run_reporter
       Thread.new do
-        @options.create_output do |output|
+        @options.open_output do |output|
           loop do
             result = @different_results.pop
             break if result.nil?
@@ -210,6 +210,7 @@ module GroongaQueryLog
         @request_queue_size = nil
         @disable_cache = false
         @output_path = nil
+        @output_opened = false
         @target_command_names = [
           "io_flush",
           "logical_count",
@@ -264,10 +265,16 @@ module GroongaQueryLog
         end
       end
 
-      def create_output(&block)
+      def open_output(&block)
         if @output_path
-          FileUtils.mkdir_p(File.dirname(@output_path))
-          File.open(@output_path, "w", &block)
+          if @output_opened
+            mode = "a"
+          else
+            FileUtils.mkdir_p(File.dirname(@output_path))
+            mode = "w"
+            @output_opened = true
+          end
+          File.open(@output_path, mode, &block)
         else
           yield($stdout)
         end
-------------- next part --------------
HTML����������������������������...
URL: https://lists.osdn.me/mailman/archives/groonga-commit/attachments/20181009/6b7792b7/attachment.htm 



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