Skip to content

Instantly share code, notes, and snippets.

@halostatue
Created September 6, 2011 21:41
Show Gist options
  • Save halostatue/1199060 to your computer and use it in GitHub Desktop.
Save halostatue/1199060 to your computer and use it in GitHub Desktop.
Running an external command with popen4
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