# HG changeset patch # User Doug Simon # Date 1433863422 -7200 # Node ID 518052de60d5a58dd1f319f7178953b9e561c85d # Parent 90fd692432272179ac4783267b95f64a89ac585c handle race creating a symlink in mx diff -r 90fd69243227 -r 518052de60d5 mxtool/mx.py --- 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)