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):
return LocalCommunication(local_host)
def execute(self, command, working_dir=None):
command_line = command if working_dir is None else 'cd {}; {}'.format(working_dir, command)
#print('\t' + command_line)
# use PIPEs to avoid breaking the child process when the parent process finishes
# (works on Linux, solution for Windows is to add creationflags=0x00000010 instead of stdout, stderr, stdin)
if working_dir is None:
command_line = command
else:
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)
subprocess.call([command_line], shell=True)
#res = subprocess.call([command_line], shell=True)
res = subprocess.run(command_line, shell=True)
return [], []
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