lib/grntest/executors/standard-io-executor.rb in grntest-1.1.2 vs lib/grntest/executors/standard-io-executor.rb in grntest-1.1.3

- old
+ new

@@ -25,23 +25,23 @@ @input = input @output = output end def send_command(command) - command_line = @current_command.original_source - unless @current_command.has_key?(:output_type) + command_line = command.original_source + if !command.key?(:output_type) and @output_type command_line = command_line.sub(/$/, " --output_type #{@output_type}") end begin @input.print(command_line) @input.print("\n") @input.flush rescue SystemCallError message = "failed to write to groonga: <#{command_line}>: #{$!}" raise Error.new(message) end - read_output + read_output(command) end def ensure_groonga_ready @input.print("status\n") @input.flush @@ -51,22 +51,27 @@ def create_sub_executor(context) self.class.new(@input, @output, context) end private - def read_output + def read_output(command) options = {} - options[:first_timeout] = @long_timeout if may_slow_command? + if may_slow_command?(command) + options[:first_timeout] = @long_timeout + elsif command.name == "dump" + options[:first_timeout] = 0.1 + end read_all_readable_content(@output, options) end MAY_SLOW_COMMANDS = [ "column_create", - "register", "load", + "plugin_register", + "register", ] - def may_slow_command? - MAY_SLOW_COMMANDS.include?(@current_command.name) + def may_slow_command?(command) + MAY_SLOW_COMMANDS.include?(command.name) end end end end