Mercurial > hg > truffle
diff mxtool/mx.py @ 21880:518052de60d5
handle race creating a symlink in mx
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Tue, 09 Jun 2015 17:23:42 +0200 |
parents | fe0d57a9b79b |
children | 969ae2657b92 |
line wrap: on
line diff
--- a/mxtool/mx.py Tue Jun 09 12:50:43 2015 +0200 +++ b/mxtool/mx.py Tue Jun 09 17:23:42 2015 +0200 @@ -651,7 +651,15 @@ if canSymlink and 'symlink' in dir(os): if exists(path): os.unlink(path) - os.symlink(cachePath, path) + try: + os.symlink(cachePath, path) + except OSError as e: + # When doing parallel building, the symlink can fail + # if another thread wins the race to create the symlink + if not exists(path): + # It was some other error + raise e + else: shutil.copy(cachePath, path)