Commit c6401bbc authored by Anton Pershin's avatar Anton Pershin

Fixed wrong Windows command in execute() in LocalCommunication

parent fc326355
...@@ -165,12 +165,19 @@ class LocalCommunication(BaseCommunication): ...@@ -165,12 +165,19 @@ class LocalCommunication(BaseCommunication):
return LocalCommunication(local_host) return LocalCommunication(local_host)
def execute(self, command, working_dir=None): def execute(self, command, working_dir=None):
command_line = command if working_dir is None else 'cd {}; {}'.format(working_dir, command) if working_dir is None:
#print('\t' + command_line) command_line = command
# use PIPEs to avoid breaking the child process when the parent process finishes else:
# (works on Linux, solution for Windows is to add creationflags=0x00000010 instead of stdout, stderr, stdin) if os.name == 'posix':
command_line = 'cd {}; {}'.format(working_dir, command)
elif os.name == 'nt':
command_line = ''
if working_dir[0] != 'C':
command_line += f'{working_dir[0]}: && '
command_line += 'cd {} && {}'.format(working_dir, command)
#self._print_exec_msg(command_line, is_remote=False) #self._print_exec_msg(command_line, is_remote=False)
subprocess.call([command_line], shell=True) #res = subprocess.call([command_line], shell=True)
res = subprocess.run(command_line, shell=True)
return [], [] return [], []
def copy(self, from_, to_, mode='from_local', show_msg=False): def copy(self, from_, to_, mode='from_local', show_msg=False):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment