Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Locks acquired by one user when downloading a compiler will prevent other users from doing the same, because the name of the lock file depends only on the solc version, but not on the user id, and the lock file is owned by the first user.
  • Loading branch information
gsalzer authored Dec 14, 2022
1 parent 486481d commit e6437a6
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion solcx/utils/lock.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import sys
import tempfile
import threading
import getpass
from pathlib import Path
from typing import Any, Dict, Union

Expand Down Expand Up @@ -36,7 +37,7 @@ class _ProcessLock:

def __init__(self, lock_id: str) -> None:
self._lock = threading.Lock()
self._lock_path = Path(tempfile.gettempdir()).joinpath(f".solcx-lock-{lock_id}")
self._lock_path = Path(tempfile.gettempdir()).joinpath(f".solcx-lock-{getpass.getuser()}-{lock_id}")
self._lock_file = self._lock_path.open("w")


Expand Down

0 comments on commit e6437a6

Please sign in to comment.