Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Restore name "triblerd.lock" for lock file #6992

Merged
merged 2 commits into from
Aug 11, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions src/tribler/core/utilities/process_checker.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
from tribler.core.utilities.path_util import Path


LOCK_FILE_NAME = 'triblerd.lock'


@contextmanager
def single_tribler_instance(directory: Path):
checker = ProcessChecker(directory)
Expand All @@ -28,9 +31,9 @@ class ProcessChecker:
This class contains code to check whether a Tribler process is already running.
"""

def __init__(self, directory: Path, lock_file_name: str = 'tribler.lock'):
def __init__(self, directory: Path, lock_file_name: Optional[str] = None):
self.logger = logging.getLogger(self.__class__.__name__)
self.lock_file = directory / lock_file_name
self.lock_file = directory / (lock_file_name or LOCK_FILE_NAME)
kozlovsky marked this conversation as resolved.
Show resolved Hide resolved
self.re_tribler = re.compile(r'tribler\b(?![/\\])')
self.logger.info(f'Lock file: {self.lock_file}')

Expand Down