This repository has been archived by the owner on Feb 4, 2020. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
clcache/__main.py__ : can retry save stats.txt
On long compilations with a lots of hits, stats.txt can sometimes fail to be saved. This patch allows a second try after one second. It has been successfully tested on a 600kLoc project, where this error was frequent. full stack trace of the error that is corrected 29> """ 29> Traceback (most recent call last): 29> File "c:\python36-32\lib\concurrent\futures\process.py", line 175, in _process_worker 29> r = call_item.fn(*call_item.args, **call_item.kwargs) 29> File "c:\python36-32\lib\site-packages\clcache\__main__.py", line 1725, in processSingleSource 29> return processDirect(cache, objectFile, compiler, cmdLine, sourceFile) 29> File "c:\python36-32\lib\site-packages\clcache\__main__.py", line 1755, in processDirect 29> return processCacheHit(cache, objectFile, cachekey) 29> File "c:\python36-32\lib\site-packages\clcache\__main__.py", line 1537, in processCacheHit 29> stats.registerCacheHit() 29> File "c:\python36-32\lib\site-packages\clcache\__main__.py", line 153, in untrackedFunc 29> return func(*args, **kwargs) 29> File "c:\python36-32\lib\site-packages\clcache\__main__.py", line 795, in __exit__ 29> self._stats.save() 29> File "c:\python36-32\lib\site-packages\clcache\__main__.py", line 703, in save 29> json.dump(self._dict, f, sort_keys=True, indent=4) 29> File "c:\python36-32\lib\contextlib.py", line 88, in __exit__ 29> next(self.gen) 29> File "c:\python36-32\lib\site-packages\clcache\__main__.py", line 162, in atomicWrite 29> os.replace(tempFileName, fileName) 29> PermissionError: [WinError 5] Access is denied: 'C:\\Users\\pascal\\clcache\\stats.txt.new' -> 'C:\\Users\\pascal\\clcache\\stats.txt' 29> """
- Loading branch information