diff options
author | Miklós Fazekas <mfazekas@szemafor.com> | 2017-07-11 19:04:06 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-07-11 19:04:06 +0200 |
commit | 1db603f5759a32f51d303f9eeb112222e6dac37e (patch) | |
tree | d2797b2fb8d11c17f686569305cda7efdd8f1f8c /lib | |
parent | f2bfec4246c23e93b3c0d9a6a277a7c2e382e6ad (diff) | |
parent | 6572c5f54ee53df08ae47684a11a0ae9885a64de (diff) | |
download | net-ssh-1db603f5759a32f51d303f9eeb112222e6dac37e.tar.gz |
Merge pull request #531 from mfazekas/call-process-after-wait
Call a process after the loop so we actually send stuff enqueued by s…
Diffstat (limited to 'lib')
-rw-r--r-- | lib/net/ssh/connection/session.rb | 9 | ||||
-rw-r--r-- | lib/net/ssh/test/extensions.rb | 2 |
2 files changed, 10 insertions, 1 deletions
diff --git a/lib/net/ssh/connection/session.rb b/lib/net/ssh/connection/session.rb index 07b4daf..a69b4f6 100644 --- a/lib/net/ssh/connection/session.rb +++ b/lib/net/ssh/connection/session.rb @@ -176,6 +176,15 @@ module Net; module SSH; module Connection def loop(wait=nil, &block) running = block || Proc.new { busy? } loop_forever { break unless process(wait, &running) } + begin + process(0) + rescue IOError => e + if e.message =~ /closed/ + debug { "stream was closed after loop => shallowing exception so it will be re-raised in next loop" } + else + raise + end + end end # The core of the event loop. It processes a single iteration of the event diff --git a/lib/net/ssh/test/extensions.rb b/lib/net/ssh/test/extensions.rb index 5583ec6..b3b188a 100644 --- a/lib/net/ssh/test/extensions.rb +++ b/lib/net/ssh/test/extensions.rb @@ -155,7 +155,7 @@ module Net; module SSH; module Test processed += 1 if reader.idle! end - raise "no readers were ready for reading, and none had any incoming packets" if processed == 0 + raise "no readers were ready for reading, and none had any incoming packets" if processed == 0 && wait != 0 end end end |