diff --git a/tools/terminal_tool_sudo.py b/tools/terminal_tool_sudo.py index 9e02a4a1d2..3dcd91f3d1 100644 --- a/tools/terminal_tool_sudo.py +++ b/tools/terminal_tool_sudo.py @@ -229,8 +229,7 @@ def _prompt_for_sudo_password(timeout_seconds: int = 45) -> str: sys.stdout.flush() return "" finally: - if "HERMES_SPINNER_PAUSE" in os.environ: - del os.environ["HERMES_SPINNER_PAUSE"] + os.environ.pop("HERMES_SPINNER_PAUSE", None) def _looks_like_env_assignment(token: str) -> bool: @@ -400,8 +399,8 @@ def _transform_sudo_command(command: str | None) -> tuple[str | None, str | None if sudo_count == 0: return command, None - # Scope-aware read: under multiplex the process env may hold another profile's - # SUDO_PASSWORD; unscoped callers (UnscopedSecretError) keep the os.environ read. + # Scope-aware read: under multiplex the process env may hold another profile's SUDO_PASSWORD; + # unscoped callers (UnscopedSecretError) keep the os.environ read. try: from agent.secret_scope import get_secret _configured_password = get_secret("SUDO_PASSWORD")