Class: SolrWrapper::PopenRunner

Inherits:
Runner
  • Object
show all
Defined in:
lib/solr_wrapper/popen_runner.rb

Overview

Runs a command using popen (typically for MRI)

Instance Attribute Summary

Attributes inherited from Runner

#cmd, #config, #options

Instance Method Summary collapse

Methods inherited from Runner

#initialize, #silence_output?

Constructor Details

This class inherits a constructor from SolrWrapper::Runner

Instance Method Details

#run(stringio) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/solr_wrapper/popen_runner.rb', line 4

def run(stringio)
  exit_status = nil
  IO.popen(config.env, argument_list + [err: [:child, :out]]) do |io|
    if config.verbose? && !silence_output?
      IO.copy_stream(io, $stderr)
    else
      IO.copy_stream(io, stringio)
    end

    _, exit_status = Process.wait2(io.pid)
  end
  stringio.rewind
  exit_status
end