Commit 578e5e54 authored by iannucci@chromium.org's avatar iannucci@chromium.org

Catch and print OSError instead of Exception.

Also open the altfile with 'w' because we assume ownership over the object
alternates. The logic to correctly support other alternates would be quite
complex, so don't even imply support.

R=maruel@chromium.org
BUG=

Review URL: https://chromiumcodereview.appspot.com/19777004

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@212426 0039d316-1c4b-4281-b951-d872f2087c98
parent f3ec5784
......@@ -761,7 +761,7 @@ class GitWrapper(SCMWrapper):
if self.cache_dir:
if not os.path.exists(altfile):
try:
with open(altfile, 'wa') as f:
with open(altfile, 'w') as f:
f.write(os.path.join(url, 'objects'))
# pylint: disable=C0301
# This dance is necessary according to emperical evidence, also at:
......@@ -773,8 +773,8 @@ class GitWrapper(SCMWrapper):
# this path again next time.
try:
os.remove(altfile)
except Exception:
pass
except OSError as e:
print >> sys.stderr, "FAILED: os.remove('%s') -> %s" % (altfile, e)
raise
else:
if os.path.exists(altfile):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment