Skip to content

Commit

Permalink
Merge 8305dae into 03168dd
Browse files Browse the repository at this point in the history
  • Loading branch information
tgbugs committed Mar 21, 2019
2 parents 03168dd + 8305dae commit ef821e4
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions pexpect/pxssh.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ def sync_original_prompt (self, sync_multiplier=1.0):
### TODO: This is getting messy and I'm pretty sure this isn't perfect.
### TODO: I need to draw a flow chart for this.
### TODO: Unit tests for SSH tunnels, remote SSH command exec, disabling original prompt sync
def login (self, server, username, password='', terminal_type='ansi',
def login (self, server, username=None, password='', terminal_type='ansi',
original_prompt=r"[#$]", login_timeout=10, port=None,
auto_prompt_reset=True, ssh_key=None, quiet=True,
sync_multiplier=1, check_local_ip=True,
Expand Down Expand Up @@ -354,7 +354,13 @@ def login (self, server, username, password='', terminal_type='ansi',
if spawn_local_ssh==False:
tunnel = quote(str(tunnel))
ssh_options = ssh_options + ' -' + cmd_type + ' ' + str(tunnel)
cmd = "ssh %s -l %s %s" % (ssh_options, username, server)

if username is not None:
ssh_options = ssh_options + ' -l ' + username
elif ssh_config is None:
raise TypeError('login() needs either a username or an ssh_config')

cmd = "ssh %s %s" % (ssh_options, server)
if self.debug_command_string:
return(cmd)

Expand Down

0 comments on commit ef821e4

Please sign in to comment.