Skip to content

Instantly share code, notes, and snippets.

@jstultz
Created March 6, 2013 23:48
Show Gist options
  • Save jstultz/3e33837f6f1c120dcff8 to your computer and use it in GitHub Desktop.
Save jstultz/3e33837f6f1c120dcff8 to your computer and use it in GitHub Desktop.
def self.sys(env, *command)
IO.pipe do |rd, wr|
read_thread = Thread.start { rd.read }
result = system(env, *command, err: wr, out: wr, close_others: true)
wr.close
raise "error: #{command * ' '}\n#{read_thread.value}" unless $?.success?
result
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment