summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Silverstone <daniel.silverstone@codethink.co.uk>2018-10-02 13:32:14 +0100
committerDaniel Silverstone <daniel.silverstone@codethink.co.uk>2018-10-04 10:04:21 +0100
commitb8421a9c86e4dc5f860516ef05163b99fd72809c (patch)
treef373e7361166a782dc8d0940d0e3f8cffa9e4a94
parentdf0d5a8b704c828357d0dbb8c37ab2c4e7d36ae6 (diff)
downloadbuildstream-b8421a9c86e4dc5f860516ef05163b99fd72809c.tar.gz
_site.py: Protect against failure running `bwrap --version`
On some potentially broken systems, running `bwrap --version` might fail with an error code. This patch corrects the oversight ensuring that we cleanly return False for version checking in such cases. Signed-off-by: Daniel Silverstone <daniel.silverstone@codethink.co.uk>
-rw-r--r--buildstream/_site.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/buildstream/_site.py b/buildstream/_site.py
index ff169180f..63a49b893 100644
--- a/buildstream/_site.py
+++ b/buildstream/_site.py
@@ -78,7 +78,11 @@ def check_bwrap_version(major, minor, patch):
if not bwrap_path:
return False
cmd = [bwrap_path, "--version"]
- version = str(subprocess.check_output(cmd).split()[1], "utf-8")
+ try:
+ version = str(subprocess.check_output(cmd).split()[1], "utf-8")
+ except subprocess.CalledProcessError:
+ # Failure trying to run bubblewrap
+ return False
_bwrap_major, _bwrap_minor, _bwrap_patch = map(int, version.split("."))
# Check whether the installed version meets the requirements