require 'pier/moor'
require 'pier/pier'
require 'pier/version'

module Pier
  def runShellProc(command)
    begin
      IO.popen(command, :err=>[:child, :out]) do |io|
        while (output = io.getc) do
          print output
          $stdout.flush
        end
      end
    rescue Interrupt
    end

    $?
  end

  def runShellProcOrDie(command)
    result = runShellProc command

    if result.exitstatus != 0 && !result.exitstatus.nil? then
      exit result.exitstatus
    end
  end
end

require 'pier/moor'
require 'pier/pier'
require 'pier/version'

module Pier
  def runShellProc(command)
    system(command)
    $?
  end

  def runShellProcOrDie(command)
    result = runShellProc command

    if result.exitstatus != 0 && !result.exitstatus.nil? then
      exit result.exitstatus
    end
  end
end

Switch to using `system` for running commands
Switch to using `system` for running commands

Using `IO.popen()` does not forward the TTY, which prevents commands
like `psql` from using readline (e.g. ctrl+r). Using `system` allows
for readline to work without causing any other known issues.
