Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- require 'open3'
- out = ""
- Open3.popen2e("ping www.google.com") do |stdin, stdout_err, wait_thr|
- while !stdout_err.eof? && (next_line = stdout_err.readline) do
- puts out
- out << next_line
- end
- if wait_thr.value.success?
- puts "SUCCESS: #{wait_thr.value}"
- else
- puts "FAILED: #{wait_thr.value}"
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement