[LyX/master] ePub: quote the command only on Windows.

Thibaut Cuvelier tcuvelier at lyx.org
Sun Feb 7 05:29:56 UTC 2021


commit 6a99e885652ff68f89746ff65772718bd52b812d
Author: Thibaut Cuvelier <tcuvelier at lyx.org>
Date:   Sun Feb 7 06:27:07 2021 +0100

    ePub: quote the command only on Windows.
---
 lib/scripts/docbook2epub.py |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/lib/scripts/docbook2epub.py b/lib/scripts/docbook2epub.py
index 02d4083..e60a9d4 100644
--- a/lib/scripts/docbook2epub.py
+++ b/lib/scripts/docbook2epub.py
@@ -46,7 +46,13 @@ if __name__ == '__main__':
     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)


More information about the lyx-cvs mailing list