[diffoscope] 02/02: comparators.haskell: Also catch CalledProcessError, not just OSError

Chris Lamb chris at chris-lamb.co.uk
Fri Jan 20 03:55:08 CET 2017


This is an automated email from the git hooks/post-receive script.

lamby pushed a commit to branch master
in repository diffoscope.

commit ad9182e79092ba17ec8a2cfa09842edcbab94609
Author: Chris Lamb <lamby at debian.org>
Date:   Fri Jan 20 13:52:53 2017 +1100

    comparators.haskell: Also catch CalledProcessError, not just OSError
    
    Signed-off-by: Chris Lamb <lamby at debian.org>
---
 diffoscope/comparators/haskell.py | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/diffoscope/comparators/haskell.py b/diffoscope/comparators/haskell.py
index 09e9b80..2ecb803 100644
--- a/diffoscope/comparators/haskell.py
+++ b/diffoscope/comparators/haskell.py
@@ -81,14 +81,15 @@ class HiFile(File):
                     output = subprocess.check_output(
                         ['ghc', '--numeric-version'],
                     )
+            except (OSError, subprocess.CalledProcessError):
+                HiFile.hi_version = None
+                logger.debug("Unable to read GHC version")
+            else:
                 major, minor, patch = [
                     int(x) for x in output.decode('utf-8').strip().split('.')
                 ]
                 HiFile.hi_version = '%d%02d%d' % (major, minor, patch)
                 logger.debug("Found .hi version %s", HiFile.hi_version)
-            except OSError:
-                HiFile.hi_version = None
-                logger.debug("Unable to read GHC version")
 
         if HiFile.hi_version is None:
             return False

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/reproducible/diffoscope.git


More information about the diffoscope mailing list