@@ -93,7 +93,7 @@ def exec_command(self, cmd, wait_exit=False, verbose=False, expect_error=False,
93
93
"""
94
94
ssh_cmd = []
95
95
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 ]
97
97
elif isinstance (cmd , list ):
98
98
ssh_cmd = ['ssh' ] + self .ssh_args + [self .ssh_dest ] + cmd
99
99
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
286
286
287
287
with tempfile .NamedTemporaryFile (mode = mode , delete = False ) as tmp_file :
288
288
# 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 ]
290
290
291
291
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 ]
293
293
subprocess .run (scp_cmd , check = False ) # The file might not exist yet
294
294
tmp_file .seek (0 , os .SEEK_END )
295
295
@@ -305,7 +305,7 @@ def write(self, filename, data, truncate=False, binary=False, read_and_write=Fal
305
305
tmp_file .write (data )
306
306
307
307
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 } " ]
309
309
subprocess .run (scp_cmd , check = True )
310
310
311
311
remote_directory = os .path .dirname (filename )
0 commit comments