Created
September 6, 2011 21:41
-
-
Save halostatue/1199060 to your computer and use it in GitHub Desktop.
Running an external command with popen4
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 run_external_command(command) | |
puts command | |
output, error = IO.popen4(command) { |_, _, stdout, stderr| | |
[ stdout.read, stderr.read ] | |
} | |
status = $? | |
[ status, output, error ] | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment