def exec(cmd, options = {})
      stringio = StringIO.new
      # JRuby uses Popen4
      command_runner = IO.respond_to?(:popen4) ? Popen4Runner : PopenRunner
      runner = command_runner.new(cmd, options, config)
      exit_status = runner.run(stringio)

      if exit_status != 0 && cmd != 'status'
        raise "Failed to execute solr #{cmd}: #{stringio.read}. Further information may be available in #{instance_dir}/server/logs"
      end

      stringio
    end
def exec(cmd, options = {})
      stringio = StringIO.new
      # JRuby uses Popen4
      command_runner = IO.respond_to?(:popen4) ? Popen4Runner : PopenRunner
      runner = command_runner.new(cmd, options, config)
      exit_status = runner.run(stringio)

      if exit_status != 0 && cmd != 'status'
        raise "Failed to execute solr #{cmd}: #{stringio.read}. Further information may be available in #{instance_dir}/server/logs"
      end

      stringio
    end
Run a bin/solr command
 @param [String] cmd command to run
 @param [Hash] options key-value pairs to transform into command line arguments
 @return [StringIO] an IO object for the executed shell command
 @see https://github.com/apache/lucene-solr/blob/trunk/solr/bin/solr
 If you want to pass a boolean flag, include it in the +options+ hash with its value set to +true+
 the key will be converted into a boolean flag for you.
 @example start solr in cloud mode on port 8983
   exec('start', {p: '8983', c: true})