lib/rye/box.rb in rye-0.9.8 vs lib/rye/box.rb in rye-0.9.9
- old
+ new
@@ -669,33 +669,28 @@
@rye_ssh = Net::SSH.start(@rye_host, @rye_user, @rye_opts || {})
end
rescue Net::SSH::HostKeyMismatch => ex
STDERR.puts ex.message
print "\a" if @rye_info # Ring the bell
- if highline.ask("Continue? ").strip.match(/\Ay|yes|sure|ya\z/i)
- @rye_opts[:paranoid] = false
- retry
- else
- raise Net::SSH::HostKeyMismatch
- end
+ raise ex
rescue Net::SSH::AuthenticationFailed => ex
print "\a" if retried == 0 && @rye_info # Ring the bell once
retried += 1
@rye_opts[:auth_methods] ||= []
# Raise Net::SSH::AuthenticationFailed if publickey is the
# only auth method
if @rye_opts[:auth_methods] == ["publickey"]
- raise Net::SSH::AuthenticationFailed
+ raise ex
elsif @rye_password_prompt && (STDIN.tty? && retried <= 3)
STDERR.puts "Passwordless login failed for #{@rye_user}"
@rye_opts[:password] = highline.ask("Password: ") { |q| q.echo = '' }.strip
@rye_opts[:auth_methods].push *['keyboard-interactive', 'password']
retry
else
- raise Net::SSH::AuthenticationFailed
+ raise ex
end
end
# We add :auth_methods (a Net::SSH joint) to force asking for a
# password if the initial (key-based) authentication fails. We
@@ -815,9 +810,11 @@
rap = Rye::Rap.new(self)
rap.cmd = cmd_clean
channel = net_ssh_exec!(cmd_internal, &blk)
+ channel[:stderr].position = 0
+ channel[:stdout].position = 0
if channel[:exception]
rap = channel[:exception].rap
else
rap.add_stdout(channel[:stdout].read || '')