Skip to content

Instantly share code, notes, and snippets.

@acook
Created February 29, 2012 22:00
Show Gist options
  • Save acook/1944782 to your computer and use it in GitHub Desktop.
Save acook/1944782 to your computer and use it in GitHub Desktop.
Wrapper for external processes
def run(*args)
output = Struct.new(:pid, :stdout, :stderr)
status = Open4.popen4(*args) do |pid, stdin, stdout, stderr|
output = output.new pid, stdout.read, stderr.read
end
[status, output]
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment