]> git.lyx.org Git - lyx.git/blobdiff - lib/scripts/lyxpreview_tools.py
* lyxpreview_tool.py : Allow to look for commands with arguments.
[lyx.git] / lib / scripts / lyxpreview_tools.py
index b24f9721559e9db300c0bc733705236d9851b11a..767689f98ccaf800c946a5dedd31b7a2c47edc1c 100644 (file)
@@ -88,7 +88,8 @@ def make_texcolor(hexcolor, graphics):
 def find_exe(candidates):
     global extlist, path
 
-    for prog in candidates:
+    for command in candidates:
+        prog = command.split()[0]
         for directory in path:
             for ext in extlist:
                 full_path = os.path.join(directory, prog + ext)
@@ -97,7 +98,7 @@ def find_exe(candidates):
                     # have found it). Return just the basename to avoid
                     # problems when the path to the executable contains
                     # spaces.
-                    return os.path.basename(full_path)
+                    return command
 
     return None
 
@@ -111,7 +112,11 @@ def find_exe_or_terminate(candidates):
 
 
 def run_command_popen(cmd):
-    pipe = subprocess.Popen(cmd, shell=True, close_fds=True, stdin=subprocess.PIPE, \
+    if os.name == 'nt':
+        unix = False
+    else:
+        unix = True
+    pipe = subprocess.Popen(cmd, shell=unix, close_fds=unix, stdin=subprocess.PIPE, \
         stdout=subprocess.PIPE, stderr=subprocess.STDOUT, universal_newlines=True)
     cmd_stdout = pipe.communicate()[0]
     cmd_status = pipe.returncode