Allow arbitrary ssh args

This commit is contained in:
Ben Jackson 2019-10-14 13:39:16 +01:00
commit 8d7de7172a

View file

@ -508,8 +508,8 @@ class DebugSession( object ):
# TODO: Use the 'tarminate' request if supportsTerminateRequest set
def _PrepareAttach( self, adapter_config, launch_config ):
atttach_config = adapter_config.get( 'attach' )
if not atttach_config:
@ -520,13 +520,9 @@ class DebugSession( object ):
# e.g. expand variables when we use them, not all at once. This would
# remove the whole %PID% hack.
remote = atttach_config[ 'remote' ]
ssh = [ 'ssh' ]
if 'account' in remote:
ssh.append( remote[ 'account' ] + '@' + remote[ 'host' ] )
else:
ssh.append( remote[ 'host' ] )
ssh = self._GetSSHCommand( remote )
# FIXME: Why does this not use self._GetCommands ?
cmd = ssh + remote[ 'pidCommand' ]
self._logger.debug( 'Getting PID: %s', cmd )
@ -574,12 +570,7 @@ class DebugSession( object ):
if 'remote' in run_config:
remote = run_config[ 'remote' ]
ssh = [ 'ssh' ]
if 'account' in remote:
ssh.append( remote[ 'account' ] + '@' + remote[ 'host' ] )
else:
ssh.append( remote[ 'host' ] )
ssh = self._GetSSHCommand( remote )
commands = self._GetCommands( remote, 'run' )
for index, command in enumerate( commands ):
@ -599,6 +590,16 @@ class DebugSession( object ):
full_cmd )
def _GetSSHCommand( self, remote ):
ssh = [ 'ssh' ] + remote.get( 'ssh', {} ).get( 'args', [] )
if 'account' in remote:
ssh.append( remote[ 'account' ] + '@' + remote[ 'host' ] )
else:
ssh.append( remote[ 'host' ] )
return ssh
def _GetCommands( self, remote, pfx ):
commands = remote.get( pfx + 'Commands', None )