fix(cli): prevent update crash in non-TTY environments (#3094)

cmd_update calls input() unconditionally during config migration.
In headless environments (Telegram gateway, systemd), there's no TTY,
so input() throws EOFError and the update crashes.

Guard with sys.stdin.isatty(), default to skipping the migration
prompt when non-interactive.

Salvaged from PR #2850 by devorun. Closes #2848.
This commit is contained in:
Teknium
2026-03-25 17:34:20 -07:00
committed by GitHub
parent 281100e2df
commit 41081d718c

View File

@@ -2812,7 +2812,10 @@ def cmd_update(args):
print(f" {len(missing_config)} new config option(s) available")
print()
response = input("Would you like to configure them now? [Y/n]: ").strip().lower()
if sys.stdin.isatty():
response = input("Would you like to configure them now? [Y/n]: ").strip().lower()
else:
response = "n"
if response in ('', 'y', 'yes'):
print()