Sha256: 9e376e973ef22c61ccb2520c7f50beaa3bb173bf21b87a7b7808e5841a3a4903

Contents?: true

Size: 444 Bytes

Versions: 2

Compression:

Stored size: 444 Bytes

Contents

module EnginePack
  class CommandRunner
    def initialize(io: Open3)
      @io = io
    end

    def run(cmd, environment_variables = {})
      io.popen3(
        environment_variables,
        "#{cmd} 2>&1"
      ) do |stdin, stdout, _stderr, wait_thread|
        stdin.close_write

        while line = stdout.gets
          puts line
        end

        puts wait_thread.value
      end
    end

    private

    attr_reader :io
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
engine_pack-0.2.0 lib/engine_pack/command_runner.rb
engine_pack-0.1.0 lib/engine_pack/command_runner.rb