Skip to content

Commit

Permalink
Merge pull request #4425 from mwichmann/main/scons-msvclock
Browse files Browse the repository at this point in the history
Further mod on msvc config cache locking
  • Loading branch information
bdbaddog authored Oct 5, 2023
2 parents 0a3801e + b410336 commit 120b2cd
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion SCons/Tool/MSCommon/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,10 +119,12 @@ def read_script_env_cache() -> dict:
p = Path(CONFIG_CACHE)
if not CONFIG_CACHE or not p.is_file():
return envcache
with SCons.Util.FileLock(CONFIG_CACHE, timeout=5), p.open('r') as f:
with SCons.Util.FileLock(CONFIG_CACHE, timeout=5, writer=True), p.open('r') as f:
# Convert the list of cache entry dictionaries read from
# json to the cache dictionary. Reconstruct the cache key
# tuple from the key list written to json.
# Note we need to take a write lock on the cachefile, as if there's
# an error and we try to remove it, that's "writing" on Windows.
try:
envcache_list = json.load(f)
except json.JSONDecodeError:
Expand Down

0 comments on commit 120b2cd

Please sign in to comment.