From f9136354da7a76cff03e0760d4afba9eebde3e9c Mon Sep 17 00:00:00 2001 From: Robert-André Mauchin Date: May 07 2019 13:30:52 +0000 Subject: Merge #6 `Don't swallow the output of go get when it fails.` --- diff --git a/go2rpm/__main__.py b/go2rpm/__main__.py index f7e089c..63fdbf5 100644 --- a/go2rpm/__main__.py +++ b/go2rpm/__main__.py @@ -267,10 +267,17 @@ def download(goipath): stderr=subprocess.STDOUT) except subprocess.CalledProcessError as err: if b'no Go files in' in err.stdout: - subprocess.check_output(['go', 'get', '-d', goipath + '/...'], - stderr=subprocess.STDOUT) + try: + subprocess.check_output(['go', 'get', '-d', goipath + '/...'], + stderr=subprocess.STDOUT) + except subprocess.CalledProcessError as err: + print(f"ERROR: Unable to 'go get {goipath}':") + print(err.stdout.decode()) + sys.exit(1) else: - raise + print(f"ERROR: Unable to 'go get {goipath}':") + print(err.stdout.decode()) + sys.exit(1) repo = git.Repo(os.path.join(GIT_CACHEDIR, *get_repo_host(goipath))) repo.git.checkout("master") repo.head.reference = repo.heads.master