Backport #916 to v26-branch: Don't require a TTY for non-interactive composer server commands#925
Open
mikelittle wants to merge 1 commit into
Open
Backport #916 to v26-branch: Don't require a TTY for non-interactive composer server commands#925mikelittle wants to merge 1 commit into
mikelittle wants to merge 1 commit into
Conversation
`composer server db exec`, `s3 import-uploads`, and `s3 exec` always hardcoded `docker exec/run -it`, which fails with "cannot attach stdin to a TTY-enabled container" when the caller has no controlling terminal — CI, cron, scripts, AI agents, ssh without `-t`, docker-in-docker, and `composer dev-tools codecept`'s test-DB setup, which delegates SQL execution to `composer server db exec`. Drop `-t` from the non-interactive paths so they run anywhere stdin is available. The interactive paths (`shell`, `db` REPL, `destroy` confirmation, `logs` service picker) keep `-it` and now gate on `require_tty()`, which prints a clear error and a non-interactive alternative instead of hanging on a prompt or crashing on Docker's opaque error. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Manual backport of #916 to
v26-branch. The auto-backport bot couldn't apply this because v26-branch has acase null:arm indb()that was restructured todefault:on master.Why backport
On GitHub Actions there is no controlling TTY, so the hardcoded
docker exec -it … -dbincomposer server db execerrors withthe input device is not a TTYbefore the SQL runs. The product-dev nightly CI uses this path indirectly viacomposer dev-tools codecept's test-DB bootstrap (DROP DATABASE … CREATE DATABASE test;…), so thetest/test2DBs never get created and codecept then fails with[1044] Access denied for user 'wordpress'@'%' to database 'test'for every module suite. Travis didn't hit this because its runner supplied enough of a pseudo-TTY for-itto work.What changed
Same shape as #916 against master, adapted for v26's slightly older
db()body:composer server db exec/s3 import-uploads/s3 execdrop-tand only pass-iso they run without a controlling terminal.composer server db(interactive REPL on this branch iscase null:),shell, and thelogsservice picker keep-itand gate on a newrequire_tty()that prints a clear error and a non-interactive alternative when no terminal is attached, instead of hanging or crashing on Docker's opaque error.is_tty()/require_tty()helpers.The
dbcase on this branch differs from master:case null(REPL) anddefault(unknown subcommand) into a singledefaultarm with the non-interactive-e/--execute/-B/--batchdetection inside.case nullanddefaultarms, and the REPL path doesn't take extra options, so the-e/-Bdetection isn't needed here — the REPL is always interactive on this branch. Kept that simpler shape; just guardedcase nullwithrequire_tty().Test plan
composer server db exec -- "SELECT 1; "works without a TTY (e.g. piped through<&-).composer server dbwith a TTY still opens the interactive REPL.🤖 Generated with Claude Code