diff --git a/winnow/cli.py b/winnow/cli.py index d13beb0..5da70a4 100644 --- a/winnow/cli.py +++ b/winnow/cli.py @@ -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)