File tree Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -453,25 +453,27 @@ def execute(
453
453
logger .debug (
454
454
f'WAITING FOR END OF command output ({ bool (output )} ): { output } '
455
455
)
456
- if output == '' :
456
+ if isinstance ( output , str ) and output . strip () == '' :
457
457
break
458
458
command_output += output
459
459
command_output = command_output .removesuffix ('\r \n ' )
460
460
461
461
# get the exit code
462
462
self .ssh .sendline ('echo $?' )
463
463
self .ssh .prompt ()
464
- exit_code_str = self .ssh .before
464
+ exit_code_str = self .ssh .before . strip ()
465
465
_start_time = time .time ()
466
466
while not exit_code_str :
467
- self .ssh .prompt ()
468
- exit_code_str = self .ssh .before
467
+ self .ssh .prompt (timeout = 1 )
468
+ exit_code_str = self .ssh .before . strip ()
469
469
logger .debug (f'WAITING FOR exit code: { exit_code_str } ' )
470
470
if time .time () - _start_time > timeout :
471
471
return self ._send_interrupt (
472
472
cmd , command_output , ignore_last_output = True
473
473
)
474
- exit_code = int (exit_code_str .strip ())
474
+ exit_code = int (
475
+ exit_code_str .replace ('echo $?' , '' ).replace ('\r \n ' , '' ).strip ()
476
+ )
475
477
return exit_code , command_output
476
478
477
479
def copy_to (self , host_src : str , sandbox_dest : str , recursive : bool = False ):
You can’t perform that action at this time.
0 commit comments