Skip to content

Commit 120b2cd

Browse files
authored
Merge pull request #4425 from mwichmann/main/scons-msvclock
Further mod on msvc config cache locking
2 parents 0a3801e + b410336 commit 120b2cd

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

SCons/Tool/MSCommon/common.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,10 +119,12 @@ def read_script_env_cache() -> dict:
119119
p = Path(CONFIG_CACHE)
120120
if not CONFIG_CACHE or not p.is_file():
121121
return envcache
122-
with SCons.Util.FileLock(CONFIG_CACHE, timeout=5), p.open('r') as f:
122+
with SCons.Util.FileLock(CONFIG_CACHE, timeout=5, writer=True), p.open('r') as f:
123123
# Convert the list of cache entry dictionaries read from
124124
# json to the cache dictionary. Reconstruct the cache key
125125
# tuple from the key list written to json.
126+
# Note we need to take a write lock on the cachefile, as if there's
127+
# an error and we try to remove it, that's "writing" on Windows.
126128
try:
127129
envcache_list = json.load(f)
128130
except json.JSONDecodeError:

0 commit comments

Comments
 (0)