docsvg: safer version checking of Inkscape
authorEdouard Tisserant <edouard@beremiz.fr>
Tue, 20 Feb 2024 11:32:15 +0100
changeset 3890 6d2d37975c7c
parent 3889 e9ad68178d36
child 3891 0f375805097a
docsvg: safer version checking of Inkscape
docutil/docsvg.py
--- a/docutil/docsvg.py	Fri Jan 26 11:13:49 2024 +0100
+++ b/docutil/docsvg.py	Tue Feb 20 11:32:15 2024 +0100
@@ -76,8 +76,12 @@
     inkpath = get_inkscape_path()
     if inkpath is None:
         return None
-    return list(map(int, 
-        subprocess.check_output([inkpath,"--version"]).split()[1].split(b'.')))
+    version_string = subprocess.check_output(
+            [inkpath,"--version"], 
+            stderr=subprocess.STDOUT)
+    if version_string:
+        return list(map(int,version_string.split()[1].split(b'.')))
+    return [0,0]
 
 _inkscape_version = None
 def get_inkscape_version():