lib/rye/box.rb in rye-0.8.1 vs lib/rye/box.rb in rye-0.8.2
- old
+ new
@@ -188,17 +188,18 @@
# Reconnect as another user. This is different from su=
# which executes subsequent commands via +su -c COMMAND USER+.
# * +newuser+ The username to reconnect as
#
# NOTE: if there is an open connection, it's disconnected
- # and a new one is opened for the given user.
+ # but not reconnected because it's possible it wasn't
+ # connected yet in the first place (if you create the
+ # instance with default settings for example)
def switch_user(newuser)
return if newuser.to_s == self.user.to_s
@rye_opts ||= {}
@rye_opts[:user] = newuser
disconnect
- connect
end
# Open an interactive SSH session. This only works if STDIN.tty?
# returns true. Otherwise it returns the SSH command that would
@@ -785,10 +786,10 @@
channel[:stdout] << data if type == :stdout
if type == :stderr
# NOTE: Use sudo to test this since it prompts for a passwords.
# Use sudo -K to kill the user's timestamp (ask for a password every time)
- if data =~ /Password:/
+ if data =~ /password:/i
ret = Annoy.get_user_input("Password: ", '*')
raise Rye::NoPassword if ret.nil?
channel.send_data "#{ret}\n"
else
channel[:stderr] << data