summaryrefslogtreecommitdiff
path: root/grc/gui/Executor.py
diff options
context:
space:
mode:
Diffstat (limited to 'grc/gui/Executor.py')
-rw-r--r--grc/gui/Executor.py31
1 files changed, 30 insertions, 1 deletions
diff --git a/grc/gui/Executor.py b/grc/gui/Executor.py
index efed54b042..7d7caaaf98 100644
--- a/grc/gui/Executor.py
+++ b/grc/gui/Executor.py
@@ -44,7 +44,11 @@ class ExecFlowGraphThread(threading.Thread):
self.update_callback = callback
try:
- self.process = self.page.process = self._popen()
+ if self.flow_graph.get_option('output_language') == 'python':
+ self.process = self.page.process = self._popen()
+ elif self.flow_graph.get_option('output_language') == 'cpp':
+ self.process = self.page.process = self._cpp_popen()
+
self.update_callback()
self.start()
except Exception as e:
@@ -75,6 +79,31 @@ class ExecFlowGraphThread(threading.Thread):
shell=False, universal_newlines=True
)
+ def _cpp_popen(self):
+ """
+ Execute this C++ flow graph after generating and compiling it.
+ """
+ generator = self.page.get_generator()
+ run_command = generator.file_path + '/build/' + self.flow_graph.get_option('id')
+
+ dirname = generator.file_path
+ builddir = os.path.join(dirname, 'build')
+
+ if os.path.isfile(run_command):
+ os.remove(run_command)
+
+ 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))
+
+ return subprocess.Popen(
+ args=' '.join(run_command_args),
+ cwd=builddir,
+ stdout=subprocess.PIPE, stderr=subprocess.STDOUT,
+ shell=True, universal_newlines=True
+ )
+
def run(self):
"""
Wait on the executing process by reading from its stdout.