lib/rye/box.rb in rye-0.9.6 vs lib/rye/box.rb in rye-0.9.7

- old
+ new

@@ -675,14 +675,20 @@ raise Net::SSH::HostKeyMismatch end rescue Net::SSH::AuthenticationFailed => ex print "\a" if retried == 0 && @rye_info # Ring the bell once retried += 1 - if STDIN.tty? && retried <= 3 + + @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 + elsif 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] ||= [] @rye_opts[:auth_methods].push *['keyboard-interactive', 'password'] retry else raise Net::SSH::AuthenticationFailed end @@ -1089,10 +1095,10 @@ # This should be the POSIX SIGNAL that ended the process channel[:exit_signal] = data.read_long end channel.on_process { channel[:handler] = :on_process - print channel[:stderr].read if channel[:stderr].available > 0 + STDERR.print channel[:stderr].read if channel[:stderr].available > 0 begin send("state_#{channel[:state]}", channel) unless channel[:state].nil? rescue Interrupt debug :on_process_interrupt channel[:state] = :exit