Skip to content

togo new treats redirected stdin (/dev/null, NUL) as interactive and auto-starts docker compose #4

Closed

Description

@fadymondy

Problem

isInteractive() in cmd/new.go checks os.ModeCharDevice on stdin. /dev/null on Linux and macOS, and NUL on Windows, are character devices too. So redirecting stdin doesn't make the command non-interactive.

The prompts themselves use term.IsTerminal and fall back to their defaults. With --db supabase|postgres|togo-postgres|mysql|mongodb and Docker on PATH, provisionDatabase takes the Confirm(..., true) default and runs docker compose up -d.

Reproduction

togo new acc --db supabase --frontend nextjs </dev/null
# → runs `docker compose up -d` in ./acc

This was seen during the v0.2.33 acceptance run (#3). On that machine the run failed harmlessly: Docker had no free address pools, and it left no containers or networks behind.

Expected

When stdin is not a terminal (CI or scripted use), togo new should not provision Docker on its own.

Notes

  • This behaviour predates v0.2.33 and doesn't block that release (owner decision). It will be fixed separately, not in release: v0.2.33 on create-togo-app v0.2.0; fail togo new on broken plugin installs #3.
  • A likely fix is for isInteractive() to use term.IsTerminal(int(os.Stdin.Fd())), as internal/ui already does. That would also affect the interactive feature, frontend and database selection when stdin is redirected, so it needs its own tests.

Refs #2, circlexo/apps#78.

Activity

  1. fadymondy commented on Oct 14, 2026

    @fadymondy
    ContributorAuthor

    Fixed in #18, released in v0.2.37. isInteractive() now uses term.IsTerminal(int(os.Stdin.Fd())), so /dev/null, NUL, files and pipes are non-interactive: togo new uses defaults and flags and no longer offers or runs docker compose up -d. Covered by TestIsInteractive_RedirectedStdin.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions