Skip to content

Commit

Permalink
Handle licensecheck crash gracefully (bz #1241481).
Browse files Browse the repository at this point in the history
  • Loading branch information
leamas committed Nov 26, 2015
1 parent c25ead4 commit 787c578
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions plugins/generic.py
Expand Up @@ -706,7 +706,12 @@ def run(self):
self.log.debug("Scanning sources in " + source_dir)
if os.path.exists(source_dir):
cmd = 'licensecheck -r ' + source_dir
out = check_output(cmd, shell=True)
try:
out = check_output(cmd, shell=True)
except (OSError, CalledProcessError) as err:
self.set_passed(self.PENDING,
"Cannot run licensecheck: " + str(err))
return
self.log.debug("Got license reply, length: %d" % len(out))
files_by_license = self._parse_licenses(out)
filename = os.path.join(ReviewDirs.root,
Expand All @@ -726,7 +731,7 @@ def run(self):
len(files_by_license[self.unknown_license])
msg += ' Detailed output of licensecheck in ' + filename
self.set_passed(self.PENDING, msg)
except OSError, e:
except OSError as e:
self.log.error('OSError: %s' % str(e))
msg = ' Programmer error: ' + e.strerror
self.set_passed(self.PENDING, msg)
Expand Down

0 comments on commit 787c578

Please sign in to comment.