lib/net/ssh/proxy/command.rb in net-ssh-3.0.1 vs lib/net/ssh/proxy/command.rb in net-ssh-3.0.2.rc1

- old
+ new

@@ -77,14 +77,29 @@ def io.recv(size) sysread(size) end else def io.send(data, flag) - write_nonblock(data) + begin + result = write_nonblock(data) + rescue IO::WaitWritable, Errno::EINTR + IO.select(nil, [self]) + retry + end + result end def io.recv(size) - read_nonblock(size) + begin + result = read_nonblock(size) + rescue IO::WaitReadable, Errno::EINTR + timeout_in_seconds = 20 + if IO.select([self], nil, [self], timeout_in_seconds) == nil + raise "Unexpected spurious read wakeup" + end + retry + end + result end end io end end