@@ -93,7 +93,7 @@ def exec_command(self, cmd, wait_exit=False, verbose=False, expect_error=False,
9393 """
9494 ssh_cmd = []
9595 if isinstance (cmd , str ):
96- ssh_cmd = ['ssh' ] + self .ssh_args + [self .ssh_dest + cmd ]
96+ ssh_cmd = ['ssh' ] + self .ssh_args + [self .ssh_dest , cmd ]
9797 elif isinstance (cmd , list ):
9898 ssh_cmd = ['ssh' ] + self .ssh_args + [self .ssh_dest ] + cmd
9999 process = subprocess .Popen (ssh_cmd , stdin = subprocess .PIPE , stdout = subprocess .PIPE , stderr = subprocess .PIPE )
@@ -286,10 +286,10 @@ def write(self, filename, data, truncate=False, binary=False, read_and_write=Fal
286286
287287 with tempfile .NamedTemporaryFile (mode = mode , delete = False ) as tmp_file :
288288 # Because in scp we set up port using -P option
289- scp_ssh_cmd = ['-P' if x == '-p' else x for x in self .ssh_cmd ]
289+ scp_args = ['-P' if x == '-p' else x for x in self .ssh_args ]
290290
291291 if not truncate :
292- scp_cmd = ['scp' ] + self . ssh_args + [f"{ self .ssh_dest } :{ filename } " , tmp_file .name ]
292+ scp_cmd = ['scp' ] + scp_args + [f"{ self .ssh_dest } :{ filename } " , tmp_file .name ]
293293 subprocess .run (scp_cmd , check = False ) # The file might not exist yet
294294 tmp_file .seek (0 , os .SEEK_END )
295295
@@ -305,7 +305,7 @@ def write(self, filename, data, truncate=False, binary=False, read_and_write=Fal
305305 tmp_file .write (data )
306306
307307 tmp_file .flush ()
308- scp_cmd = ['scp' ] + self . ssh_args + [tmp_file .name , f"{ self .ssh_dest } :{ filename } " ]
308+ scp_cmd = ['scp' ] + scp_args + [tmp_file .name , f"{ self .ssh_dest } :{ filename } " ]
309309 subprocess .run (scp_cmd , check = True )
310310
311311 remote_directory = os .path .dirname (filename )
0 commit comments