Catch CalledProcessError when downloading dependencies with buck

When calling curl with check_call, CalledProcessError can be
raised.  Catch it to avoid an ugly python traceback in the build
log.

Change-Id: Icd56b94391fc6fb51e4d84889b123e892d15bc5b
This commit is contained in:
David Pursehouse
2013-05-09 14:58:20 +01:00
parent aef44b033d
commit 2879877ef4

View File

@@ -17,7 +17,7 @@ from hashlib import sha1
from optparse import OptionParser from optparse import OptionParser
from os import link, makedirs, path from os import link, makedirs, path
import shutil import shutil
from subprocess import check_call from subprocess import check_call, CalledProcessError
from sys import stderr from sys import stderr
from zipfile import ZipFile, BadZipfile, LargeZipFile from zipfile import ZipFile, BadZipfile, LargeZipFile
@@ -63,7 +63,7 @@ if not path.exists(cache_ent):
try: try:
safe_mkdirs(path.dirname(cache_ent)) safe_mkdirs(path.dirname(cache_ent))
check_call(['curl', '-sfo', cache_ent, args.u]) check_call(['curl', '-sfo', cache_ent, args.u])
except OSError as err: except (OSError, CalledProcessError) as err:
print >>stderr, "error using curl: %s" % str(err) print >>stderr, "error using curl: %s" % str(err)
exit(1) exit(1)