@@ -314,14 +314,20 @@ def _get_executable_info(name):
314
314
If the executable is not one that we know how to query.
315
315
"""
316
316
317
- def impl (args , regex , min_ver = None ):
317
+ def impl (args , regex , min_ver = None , ignore_exit_code = False ):
318
318
# Execute the subprocess specified by args; capture stdout and stderr.
319
319
# Search for a regex match in the output; if the match succeeds, the
320
320
# first group of the match is the version.
321
321
# Return an _ExecInfo if the executable exists, and has a version of
322
322
# at least min_ver (if set); else, raise FileNotFoundError.
323
- output = subprocess .check_output (
324
- args , stderr = subprocess .STDOUT , universal_newlines = True )
323
+ try :
324
+ output = subprocess .check_output (
325
+ args , stderr = subprocess .STDOUT , universal_newlines = True )
326
+ except subprocess .CalledProcessError as _cpe :
327
+ if ignore_exit_code :
328
+ output = _cpe .output
329
+ else :
330
+ raise _cpe
325
331
match = re .search (regex , output )
326
332
if match :
327
333
version = LooseVersion (match .group (1 ))
@@ -378,7 +384,8 @@ def impl(args, regex, min_ver=None):
378
384
"Failed to find an ImageMagick installation" )
379
385
return impl ([path , "--version" ], r"^Version: ImageMagick (\S*)" )
380
386
elif name == "pdftops" :
381
- info = impl (["pdftops" , "-v" ], "^pdftops version (.*)" )
387
+ info = impl (["pdftops" , "-v" ], "^pdftops version (.*)" ,
388
+ ignore_exit_code = True )
382
389
if info and not ("3.0" <= info .version
383
390
# poppler version numbers.
384
391
or "0.9" <= info .version <= "1.0" ):
0 commit comments