mirror of
https://github.com/PR0M3TH3AN/SeedPass.git
synced 2026-11-02 10:52:05 +00:00
fix: replace sys.exit(0) with os._exit(0) to prevent SIGSEGV on graceful exit
Python interpreter teardown with C extensions (Textual, crypto libs) can trigger SIGSEGV (-11) when sys.exit() is called. os._exit() bypasses the teardown entirely, producing a clean exit code 0. Three call sites replaced: - _cleanup_and_exit() in handle_remove_fingerprint (~line 254) - graceful exit path in main loop (~line 1520) - signal_handler shutdown path (~line 1862) Fixes: SeedPass-1d93 Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
This commit is contained in:
1 parent
0cf1d58c9c
commit
5dc8e015ae
1 file changed
+3
-3
+3
-3
@@ -251,7 +251,7 @@ def handle_remove_fingerprint(password_manager: PasswordManager):
|
||||
password_manager.is_dirty = False
|
||||
getattr(password_manager, "cleanup", lambda: None)()
|
||||
print(colored("All seed profiles removed. Exiting.", "yellow"))
|
||||
sys.exit(0)
|
||||
os._exit(0)
|
||||
|
||||
if password_manager.fingerprint_manager.remove_fingerprint(
|
||||
selected_fingerprint, _cleanup_and_exit
|
||||
@@ -1517,7 +1517,7 @@ def display_menu(
|
||||
print(colored("Exiting the program.", "green"))
|
||||
getattr(password_manager, "cleanup", lambda: None)()
|
||||
_safe_close_client_pool(password_manager)
|
||||
sys.exit(0)
|
||||
os._exit(0)
|
||||
try:
|
||||
if choice == "1":
|
||||
while True:
|
||||
@@ -1859,7 +1859,7 @@ def main(argv: list[str] | None = None, *, fingerprint: str | None = None) -> in
|
||||
except Exception as exc:
|
||||
logging.error(f"Error during shutdown: {exc}")
|
||||
print(colored(f"Error during shutdown: {exc}", "red"))
|
||||
sys.exit(0)
|
||||
os._exit(0)
|
||||
|
||||
signal.signal(signal.SIGINT, signal_handler)
|
||||
signal.signal(signal.SIGTERM, signal_handler)
|
||||
|
||||
Reference in new issue
Block a user