X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=scripts%2Fcommon.py;h=ec0cc707dba068fe73e1d2b047f3cdc423d98589;hb=aa018007b5715ab738ee88ef217576aa0d6ee561;hp=f9c19850d252d1c56f69c0ac44f5fe345ae962d0;hpb=49fea2520f5c672493a91be8c0e3bb4ef6de6e27;p=platform%2Fupstream%2Fgstreamer.git diff --git a/scripts/common.py b/scripts/common.py index f9c1985..ec0cc70 100644 --- a/scripts/common.py +++ b/scripts/common.py @@ -113,10 +113,17 @@ class Colors: -def git(*args, repository_path='.'): - return subprocess.check_output(["git"] + list(args), cwd=repository_path, - stdin=subprocess.DEVNULL, - stderr=subprocess.STDOUT).decode() +def git(*args, repository_path='.', fatal=True): + try: + ret = subprocess.check_output(["git"] + list(args), cwd=repository_path, + stdin=subprocess.DEVNULL, + stderr=subprocess.STDOUT).decode() + except subprocess.CalledProcessError as e: + if fatal: + raise e + print("Non-fatal error running git {}:\n{}".format(' '.join(args), e)) + return None + return ret def accept_command(commands): """Search @commands and returns the first found absolute path."""