From 2557eade9d738098f831974eb2bea3e2ecaa4849 Mon Sep 17 00:00:00 2001 From: Xavier Claessens Date: Tue, 14 Jul 2020 11:57:59 -0400 Subject: [PATCH] wrap: Raise MesonException when git command fails This avoid printing long backtrace by default, the user already has the output of the git command printed for debugging purpose since we don't redirect stdout/stderr. --- mesonbuild/wrap/wrap.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/mesonbuild/wrap/wrap.py b/mesonbuild/wrap/wrap.py index 54daaf35b..aba220e1b 100644 --- a/mesonbuild/wrap/wrap.py +++ b/mesonbuild/wrap/wrap.py @@ -61,7 +61,10 @@ def quiet_git(cmd: T.List[str], workingdir: str) -> T.Tuple[bool, str]: def verbose_git(cmd: T.List[str], workingdir: str, check: bool = False) -> bool: if not GIT: return False - return git(cmd, workingdir, check=check).returncode == 0 + try: + return git(cmd, workingdir, check=check).returncode == 0 + except subprocess.CalledProcessError: + raise WrapException('Git command failed') def whitelist_wrapdb(urlstr: str) -> urllib.parse.ParseResult: """ raises WrapException if not whitelisted subdomain """