Skip to content

Commit 70bfd3d

Browse files
remove settings conf lock at beginning
1 parent 3e46d81 commit 70bfd3d

3 files changed

Lines changed: 14 additions & 1 deletion

File tree

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,4 +60,5 @@ custom_profiles/
6060
# Security tools
6161
/tools/security/*
6262
Apps/Windows/inspector.exe
63-
Framework/settings.conf.lock
63+
Apps/Windows/Element.xml
64+
Framework/settings.conf.lock

Framework/Utilities/ConfigModule.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
from pathlib import Path
77
from datetime import date
88
from configobj import ConfigObj
9+
import traceback
910

1011
"""constants"""
1112
file_name = "settings.conf"
@@ -48,6 +49,16 @@ def create_settings_config_file():
4849
config.write()
4950
print(f"Created settings.conf at {settings_conf_path}")
5051

52+
def remove_settings_lock_file():
53+
"""Remove stale lock file if the process that created it is no longer running."""
54+
try:
55+
lock_file_path = Path(settings_file_lock.lock_file)
56+
if not lock_file_path.exists():
57+
return
58+
lock_file_path.unlink(missing_ok=True)
59+
except Exception:
60+
traceback.print_exc()
61+
5162
@settings_file_lock
5263
def get_config_value(section, key, location: os.PathLike | None = None):
5364
"""

node_cli.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1230,6 +1230,7 @@ async def main():
12301230
# Load environment variables from .env file
12311231
load_dotenv()
12321232
adjust_python_path()
1233+
ConfigModule.remove_settings_lock_file()
12331234
ConfigModule.create_settings_config_file()
12341235
create_temp_ini_automation_log()
12351236

0 commit comments

Comments
 (0)