fix: harden legacy/tui3 non-tty flows and shutdown stability

This commit is contained in:
thePR0M3TH3AN committed 2026-03-03 21:56:55 -05:00
1 parent d3fc572c4e
commit 033870f2df
9 files changed
+112 -4

No files matched your search

+4
View File
@@ -142,6 +142,8 @@ def prompt_new_password(max_retries: int | None = None) -> str:
print(colored("\nOperation cancelled by user.", "yellow"))
logging.info("Password prompt interrupted by user.")
raise PasswordPromptError("Operation cancelled by user")
except EOFError:
raise PasswordPromptError("Interactive password prompt requires a TTY")
except Exception as e:
logging.error(
f"Unexpected error during password prompt: {e}", exc_info=True
@@ -204,6 +206,8 @@ def prompt_existing_password(
print(colored("\nOperation cancelled by user.", "yellow"))
logging.info("Existing password prompt interrupted by user.")
raise PasswordPromptError("Operation cancelled by user")
except EOFError:
raise PasswordPromptError("Interactive password prompt requires a TTY")
except Exception as e:
logging.error(
f"Unexpected error during existing password prompt: {e}",
+2
View File
@@ -106,6 +106,8 @@ def _masked_input_posix(prompt: str) -> str:
def masked_input(prompt: str) -> str:
"""Return input from the user while masking typed characters."""
if not sys.stdin.isatty():
raise EOFError("Interactive input requires a TTY")
func = _masked_input_windows if sys.platform == "win32" else _masked_input_posix
pause_console_logging()
try: