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