]> git.lyx.org Git - features.git/commitdiff
ePub: quote the command only on Windows.
authorThibaut Cuvelier <tcuvelier@lyx.org>
Sun, 7 Feb 2021 05:27:07 +0000 (06:27 +0100)
committerThibaut Cuvelier <tcuvelier@lyx.org>
Sun, 7 Feb 2021 05:27:07 +0000 (06:27 +0100)
lib/scripts/docbook2epub.py

index 02d4083366802d08c6593364653c08f75fb04de0..e60a9d482c9a3d460dff64b2e2248344d2b4cd6e 100644 (file)
@@ -46,7 +46,13 @@ if __name__ == '__main__':
     print('Command to execute:')
     print(command)
 
     print('Command to execute:')
     print(command)
 
-    if os.system('"' + command + '"') != 0:
+    quoted_command = command
+    if os.name == 'nt':
+        # On Windows, it is typical to have spaces in folder names, and that requires to wrap the whole command
+        # in quotes. On Linux, this might create errors when starting the command.
+        quoted_command = '"' + command + '"'
+
+    if os.system(quoted_command) != 0:
         print('docbook2epub fails')
         shutil.rmtree(output_dir, ignore_errors=True)
         sys.exit(1)
         print('docbook2epub fails')
         shutil.rmtree(output_dir, ignore_errors=True)
         sys.exit(1)