@@ -313,14 +313,20 @@ def _get_executable_info(name):
313313 If the executable is not one that we know how to query.
314314 """
315315
316- def impl (args , regex , min_ver = None ):
316+ def impl (args , regex , min_ver = None , ignore_exit_code = False ):
317317 # Execute the subprocess specified by args; capture stdout and stderr.
318318 # Search for a regex match in the output; if the match succeeds, the
319319 # first group of the match is the version.
320320 # Return an _ExecInfo if the executable exists, and has a version of
321321 # 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
324330 match = re .search (regex , output )
325331 if match :
326332 version = LooseVersion (match .group (1 ))
@@ -377,7 +383,8 @@ def impl(args, regex, min_ver=None):
377383 "Failed to find an ImageMagick installation" )
378384 return impl ([path , "--version" ], r"^Version: ImageMagick (\S*)" )
379385 elif name == "pdftops" :
380- info = impl (["pdftops" , "-v" ], "^pdftops version (.*)" )
386+ info = impl (["pdftops" , "-v" ], "^pdftops version (.*)" ,
387+ ignore_exit_code = True )
381388 if info and not ("3.0" <= info .version
382389 # poppler version numbers.
383390 or "0.9" <= info .version <= "1.0" ):
0 commit comments