From 8d62df788b01c76e47806f04dc6f064acda334ef Mon Sep 17 00:00:00 2001
From: Sebastian Koslowski <koslowski@kit.edu>
Date: Sun, 2 Nov 2014 19:14:07 +0100
Subject: grc: fix xterm setting check

---
 grc/python/Generator.py | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

(limited to 'grc/python/Generator.py')

diff --git a/grc/python/Generator.py b/grc/python/Generator.py
index caf45fa3b1..4a496b7c0f 100644
--- a/grc/python/Generator.py
+++ b/grc/python/Generator.py
@@ -21,6 +21,7 @@ import os
 import sys
 import subprocess
 import tempfile
+from distutils.spawn import find_executable
 from Cheetah.Template import Template
 import expr_utils
 from Constants import \
@@ -96,8 +97,9 @@ This is usually undesired. Consider removing the throttle block.''')
         cmds = [python_exe, '-u', self.get_file_path()]  # -u is unbuffered stdio
 
         # when in no gui mode on linux, use a graphical terminal (looks nice)
-        if self._generate_options == 'no_gui' and os.path.exists(XTERM_EXECUTABLE):
-            cmds = [XTERM_EXECUTABLE, '-e'] + cmds
+        xterm_executable = find_executable(XTERM_EXECUTABLE)
+        if self._generate_options == 'no_gui' and xterm_executable:
+            cmds = [xterm_executable, '-e'] + cmds
 
         p = subprocess.Popen(args=cmds, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, shell=False, universal_newlines=True)
         return p
-- 
cgit v1.2.3