Skip to content

Instantly share code, notes, and snippets.

@hdenman
hdenman / popen3_ssh.rb
Last active September 6, 2017 22:36
Quick-n-dirty Ruby popen3 ssh benchmark
bytes_read = 0
cmd = "ssh -i #{key_file} #{user}@#{ip} 'base64 /dev/urandom'"
Open3.popen3(cmd) do |i, o, e, t| # (in, out, error, monitor thread)
begin
Timeout.timeout(120) do
while readables = IO.select([o, e])[0]
readables.each{|r|
if r == o
dump = ""
begin