Sha256: e145c530a9314e660747f763e191f2840e005cd600f1818bddd1de9abcd7aab0

Contents?: true

Size: 518 Bytes

Versions: 50

Compression:

Stored size: 518 Bytes

Contents

require 'pty'

module CommandRunner
  def self.run_command_and_print(cmd, output)
    output.puts "Executing #{cmd}\n\n"

    PTY.spawn(cmd) do |read_stream, write_stream, pid|
      begin
        while chars = read_stream.read(1)
          output.print chars
        end
      rescue Errno::EIO
      end
      Process.wait(pid)
    end
    output.puts "\n\n\n"

    if $?
      exit 1 if $?.exitstatus > 0
    else
      raise "Huh?! We didn't get an exit status from that last one: #{cmd}"
    end
  end
end

Version data entries

50 entries across 50 versions & 1 rubygems

Version Path
roqua-support-0.4.6 lib/roqua/support/command_runner.rb
roqua-support-0.4.5 lib/roqua/support/command_runner.rb
roqua-support-0.4.4 lib/roqua/support/command_runner.rb
roqua-support-0.4.3 lib/roqua/support/command_runner.rb
roqua-support-0.4.2 lib/roqua/support/command_runner.rb
roqua-support-0.4.1 lib/roqua/support/command_runner.rb
roqua-support-0.4.0 lib/roqua/support/command_runner.rb
roqua-support-0.3.5 lib/roqua/support/command_runner.rb
roqua-support-0.3.4 lib/roqua/support/command_runner.rb
roqua-support-0.3.3 lib/roqua/support/command_runner.rb
roqua-support-0.3.2 lib/roqua/support/command_runner.rb
roqua-support-0.3.1 lib/roqua/support/command_runner.rb
roqua-support-0.3.0 lib/roqua/support/command_runner.rb
roqua-support-0.1.34 lib/roqua/support/command_runner.rb
roqua-support-0.1.33 lib/roqua/support/command_runner.rb
roqua-support-0.1.32 lib/roqua/support/command_runner.rb
roqua-support-0.1.31 lib/roqua/support/command_runner.rb
roqua-support-0.1.30 lib/roqua/support/command_runner.rb
roqua-support-0.1.29 lib/roqua/support/command_runner.rb
roqua-support-0.1.28 lib/roqua/support/command_runner.rb