-
-
Save jstultz/3e33837f6f1c120dcff8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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