fix: auto-detect missing TTY and fall back to auto mode
When stdin has no TTY (Docker without -it), IntPrompt/Confirm raise EOFError and crash the container into a restart loop. Treat a non-TTY stdin the same as AUTO_MODE=true so headless runs work without any env var configuration. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
+8
-3
@@ -2,6 +2,7 @@
|
||||
|
||||
import logging
|
||||
import os
|
||||
import sys
|
||||
|
||||
from rich import print as rprint
|
||||
from rich.prompt import Confirm
|
||||
@@ -63,15 +64,19 @@ def main() -> None:
|
||||
rprint("[bold red]Could not fetch people from Immich. Check URL/Key.[/bold red]")
|
||||
return
|
||||
|
||||
# Check for non-interactive mode
|
||||
auto_mode = os.environ.get("AUTO_MODE", "false").lower() == "true"
|
||||
# Check for non-interactive mode; also force auto when stdin has no TTY
|
||||
# (e.g. Docker without -it) to avoid an EOFError crash
|
||||
auto_mode = os.environ.get("AUTO_MODE", "false").lower() == "true" or not sys.stdin.isatty()
|
||||
dry_run = os.environ.get("DRY_RUN", "false").lower() in ("true", "1", "yes")
|
||||
|
||||
if dry_run:
|
||||
rprint("[bold yellow]DRY RUN — no images will be downloaded or uploaded[/bold yellow]")
|
||||
|
||||
if auto_mode:
|
||||
rprint("[bold cyan]Running in AUTO mode (non-interactive)[/bold cyan]")
|
||||
if not sys.stdin.isatty() and os.environ.get("AUTO_MODE", "false").lower() != "true":
|
||||
rprint("[dim]No TTY detected — running in auto mode. Set AUTO_MODE=true to suppress this.[/dim]")
|
||||
else:
|
||||
rprint("[bold cyan]Running in AUTO mode (non-interactive)[/bold cyan]")
|
||||
jobs = auto_configure(people)
|
||||
else:
|
||||
jobs = interactive_configure(people)
|
||||
|
||||
Reference in New Issue
Block a user