Skip to content

Instantly share code, notes, and snippets.

@miroswan
Created June 29, 2015 22:59
Show Gist options
  • Save miroswan/8c995bc761c89af9bf86 to your computer and use it in GitHub Desktop.
Save miroswan/8c995bc761c89af9bf86 to your computer and use it in GitHub Desktop.
def shell_out(cmd)
Open3.popen2e(cmd) do |stdin, stdoe, thread|
stdoe.sync = true
puts thread.pid
until stdoe.eof?
puts stdoe.gets
end
thread.value
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment