Skip to content

fix(cli): suppress legacy task spinner when stdout is not a TTY#5400

Open
zlotnika wants to merge 1 commit into
supabase:developfrom
zlotnika:fix/branches-list-spinner-stdout
Open

fix(cli): suppress legacy task spinner when stdout is not a TTY#5400
zlotnika wants to merge 1 commit into
supabase:developfrom
zlotnika:fix/branches-list-spinner-stdout

Conversation

@zlotnika
Copy link
Copy Markdown

@zlotnika zlotnika commented May 30, 2026

v2.102.0 ported branches, secrets, orgs, sso, ssl-enforcement, network-restrictions, backups, etc. to TS. Each ported handler wraps its API call in:

const fetching = output.format === "text" ? yield* output.task("...") : undefined;

output.format is the TS --output-format flag, not the Go --output flag (goFmt). Passing Go-style --output json leaves output.format === "text", so the @clack spinner starts after 200ms and writes cursor-hide (ESC [?25l) + a frame to stdout ahead of the JSON — breaking jq in CI. Go pre-2.102.0 emitted clean JSON.

Fix at the source: textOutputLayer.task returns a no-op task when tty.stdoutIsTty is false. Covers all 28+ ported call sites without per-handler patches; the jsonOutputLayer / streamJsonOutputLayer task impls already route through stderr / events.

Test asserts spinner() is never called when stdoutIsTty: false.

Fixes #5397

v2.102.0 ported branches/secrets/orgs/etc. to TypeScript. The new
textOutputLayer.task starts a @Clack spinner after 200ms regardless
of whether stdout is a TTY, so commands like
`supabase branches list --output json` in CI emit cursor-hide and
animated-frame ANSI to stdout ahead of the JSON, breaking jq parsing.

Skip the spinner entirely when stdout is not a TTY — the animated
frames are meaningless without a terminal, and stdout there is being
consumed by a pipe / redirect / CI runner.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

branches list -o json emits spinner ANSI to stdout since v2.102.0, breaking JSON parsing

1 participant