diff options
author | japm48 <japm48@users.noreply.github.com> | 2020-04-17 05:02:33 +0200 |
---|---|---|
committer | Michael Dickens <michael.dickens@ettus.com> | 2020-04-26 18:59:26 -0400 |
commit | 3e62d311565dfcccffaf4a380f399db4d0df9c98 (patch) | |
tree | 5ddd861cfa05a6b94422168d01475ef68a8eb1c8 | |
parent | d4309f372ddb601c6da19003a21a7d151ff339d6 (diff) |
grc: start flowgraph process in its folder
This allows the use of predictable relative paths.
-rw-r--r-- | grc/gui/Executor.py | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/grc/gui/Executor.py b/grc/gui/Executor.py index 7a32a643d7..7b4e006f3c 100644 --- a/grc/gui/Executor.py +++ b/grc/gui/Executor.py @@ -11,6 +11,7 @@ import shlex import subprocess import threading import time +from pathlib import Path from distutils.spawn import find_executable from gi.repository import GLib @@ -62,8 +63,11 @@ class ExecFlowGraphThread(threading.Thread): # it looks really ugly and confusing in the console panel. Messages.send_start_exec(' '.join(run_command_args)) + dirname = Path(generator.file_path).parent + return subprocess.Popen( args=run_command_args, + cwd=dirname, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, shell=False, universal_newlines=True ) @@ -83,11 +87,11 @@ class ExecFlowGraphThread(threading.Thread): xterm_executable = find_executable(self.xterm_executable) - run_command_args = ['cmake .. &&', 'make && ', xterm_executable, '-e', run_command] - Messages.send_start_exec(' '.join(run_command_args)) + run_command_args = f'cmake .. && make && cd ../.. && {xterm_executable} -e {run_command}' + Messages.send_start_exec(run_command_args) return subprocess.Popen( - args=' '.join(run_command_args), + args=run_command_args, cwd=builddir, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, shell=True, universal_newlines=True |