module PipeExec

Constants

VERSION

Public Class Methods

run(command) click to toggle source
# File lib/pipe_exec.rb, line 4
def self.run(command)
  require 'pty'
  begin
    PTY.spawn(command) do |stdin, stdout, pid|
      begin
        stdin.each { |line| print line }
      rescue Errno::EIO
      end
    end
  rescue PTY::ChildExited
    puts "The child process exited!"
  end
end