Implement cleanup guard to prevent multiple executions on exit

- Introduced a new cleanup function that ensures terminal and browser sessions are cleaned up only once during application exit.
- Updated atexit registration to use the new cleanup function, enhancing resource management and preventing potential issues from multiple cleanup calls.
- Modified terminal cleanup messaging to only display when environments are cleaned, improving user feedback.
This commit is contained in:
teknium1
2026-02-16 02:43:45 -08:00
parent 45a8098d3a
commit 01a3a6ab0d
2 changed files with 23 additions and 15 deletions

View File

@@ -1406,7 +1406,8 @@ def cleanup_all_environments():
except:
pass
print(f"[Terminal Cleanup] Cleaned {cleaned} environments")
if not os.getenv("HERMES_QUIET") and cleaned > 0:
print(f"[Terminal Cleanup] Cleaned {cleaned} environments")
return cleaned