From 6a99e885652ff68f89746ff65772718bd52b812d Mon Sep 17 00:00:00 2001 From: Thibaut Cuvelier Date: Sun, 7 Feb 2021 06:27:07 +0100 Subject: [PATCH] ePub: quote the command only on Windows. --- lib/scripts/docbook2epub.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/scripts/docbook2epub.py b/lib/scripts/docbook2epub.py index 02d4083366..e60a9d482c 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)