Sha256: 5fb806b1068f61f057348f73f691d131e752bc847e868d7da58204c4a9197acb

Contents?: true

Size: 766 Bytes

Versions: 17

Compression:

Stored size: 766 Bytes

Contents

module SolrWrapper
  # Runs a command using popen4 (typically for JRuby)
  class Popen4Runner < Runner
    def run(stringio)
      pid, input, output, error = IO.popen4(command)
      if config.verbose? && !silence_output?
        IO.copy_stream(output, $stderr)
        IO.copy_stream(error, $stderr)
      else
        IO.copy_stream(output, stringio)
        IO.copy_stream(error, stringio)
      end

      input.close
      output.close
      error.close
      exit_status = Process.waitpid2(pid).last
      stringio.rewind
      exit_status
    end

    private

    def command
      env_str + ' ' + argument_list.join(' ')
    end

    def env_str
      config.env.map { |k, v| "#{Shellwords.escape(k)}=#{Shellwords.escape(v)}" }.join(' ')
    end
  end
end

Version data entries

17 entries across 17 versions & 2 rubygems

Version Path
solr_wrapper-4.1.0 lib/solr_wrapper/popen4_runner.rb
blacklight-spotlight-3.6.0.beta8 vendor/bundle/ruby/3.2.0/gems/solr_wrapper-4.0.2/lib/solr_wrapper/popen4_runner.rb
solr_wrapper-4.0.2 lib/solr_wrapper/popen4_runner.rb
solr_wrapper-4.0.1 lib/solr_wrapper/popen4_runner.rb
solr_wrapper-4.0.0 lib/solr_wrapper/popen4_runner.rb
solr_wrapper-3.1.3 lib/solr_wrapper/popen4_runner.rb
solr_wrapper-3.1.2 lib/solr_wrapper/popen4_runner.rb
solr_wrapper-3.1.1 lib/solr_wrapper/popen4_runner.rb
solr_wrapper-3.1.0 lib/solr_wrapper/popen4_runner.rb
solr_wrapper-3.0.2 lib/solr_wrapper/popen4_runner.rb
solr_wrapper-3.0.1 lib/solr_wrapper/popen4_runner.rb
solr_wrapper-3.0.0 lib/solr_wrapper/popen4_runner.rb
solr_wrapper-2.2.0 lib/solr_wrapper/popen4_runner.rb
solr_wrapper-2.1.0 lib/solr_wrapper/popen4_runner.rb
solr_wrapper-2.0.0 lib/solr_wrapper/popen4_runner.rb
solr_wrapper-1.2.0 lib/solr_wrapper/popen4_runner.rb
solr_wrapper-1.1.0 lib/solr_wrapper/popen4_runner.rb