From 73e7a6164730051cca2555ed70b0c34935049514 Mon Sep 17 00:00:00 2001 From: Jamis Buck Date: Tue, 8 Apr 2008 08:22:39 -0600 Subject: allow on_error to be a proc, and use throw/catch to support programmatic retry/reraise --- lib/net/ssh/multi/session.rb | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/net/ssh/multi/session.rb b/lib/net/ssh/multi/session.rb index 6c31dea..4c6e1a0 100644 --- a/lib/net/ssh/multi/session.rb +++ b/lib/net/ssh/multi/session.rb @@ -381,6 +381,14 @@ module Net; module SSH; module Multi # do nothing when :warn then warn("error connecting to #{server}: #{e.class} (#{e.message})") + when Proc then + go = catch(:go) { on_error.call(server); nil } + case go + when nil, :ignore then # nothing + when :retry then retry + when :raise then raise + else warn "unknown 'go' command: #{go.inspect}" + end else raise end -- cgit v1.2.1