Mercurial > hg > graal-jvmci-8
comparison 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 | 3a292e8b9e51 |
comparison
equal
deleted
inserted
replaced
21879:90fd69243227 | 21880:518052de60d5 |
---|---|
649 os.makedirs(d) | 649 os.makedirs(d) |
650 | 650 |
651 if canSymlink and 'symlink' in dir(os): | 651 if canSymlink and 'symlink' in dir(os): |
652 if exists(path): | 652 if exists(path): |
653 os.unlink(path) | 653 os.unlink(path) |
654 os.symlink(cachePath, path) | 654 try: |
655 os.symlink(cachePath, path) | |
656 except OSError as e: | |
657 # When doing parallel building, the symlink can fail | |
658 # if another thread wins the race to create the symlink | |
659 if not exists(path): | |
660 # It was some other error | |
661 raise e | |
662 | |
655 else: | 663 else: |
656 shutil.copy(cachePath, path) | 664 shutil.copy(cachePath, path) |
657 | 665 |
658 def _sha1Cached(): | 666 def _sha1Cached(): |
659 with open(sha1path, 'r') as f: | 667 with open(sha1path, 'r') as f: |