From 16822c06edca8a03ec81db2ecd464547057a5716 Mon Sep 17 00:00:00 2001 From: Alexander Kozlovsky Date: Tue, 9 Aug 2022 18:31:40 +0200 Subject: [PATCH] Make code a bit simpler --- src/tribler/core/utilities/process_checker.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/tribler/core/utilities/process_checker.py b/src/tribler/core/utilities/process_checker.py index 7aead3218bc..07583761242 100644 --- a/src/tribler/core/utilities/process_checker.py +++ b/src/tribler/core/utilities/process_checker.py @@ -32,10 +32,11 @@ class ProcessChecker: """ def __init__(self, directory: Path, lock_file_name: Optional[str] = None): + lock_file_name = lock_file_name or LOCK_FILE_NAME + self.lock_file = directory / lock_file_name self.logger = logging.getLogger(self.__class__.__name__) - self.lock_file = directory / (lock_file_name or LOCK_FILE_NAME) - self.re_tribler = re.compile(r'tribler\b(?![/\\])') self.logger.info(f'Lock file: {self.lock_file}') + self.re_tribler = re.compile(r'tribler\b(?![/\\])') def check_and_restart_if_necessary(self) -> bool: self.logger.info('Check')