Skip to content

fix(docker): do not give commands a PTY without a terminal - #461

Merged
lyrixx merged 1 commit into
mainfrom
fix-docker-pty-without-terminal
Oct 21, 2026
Merged

lyrixx merged 1 commit into
mainfrom
fix-docker-pty-without-terminal

Conversation

@lyrixx

@lyrixx lyrixx commented Oct 21, 2026 •

Copy link
Copy Markdown
Member

Since #453, docker_compose_run() and docker_compose_exec() keep the PTY of the context. Without a terminal (CI, pipes, AI agents...), the command gets a terminal nobody types in, and a prompt waits forever (e.g. composer audit asking to trust a plugin). The default context now gives a PTY only when stdin is a terminal, outside of a CI: castor init | tee init.log can still answer the prompts.

In the shell of castor builder, a CTRL+C followed by a CTRL+D no longer ends with "has been interrupted": the shell exits with the code of its last command, 130, which Castor 1.9 takes for a CTRL+C.

The terminal tests move from the workflow to castor test:terminal (castor test:terminal:manual lists what to check by hand), and the tests of docker-starter to the test namespace. Castor 1.9 is required, for its detection of non-interactive environments (jolicode/castor#908).

lyrixx added a commit to beberlei/metrics that referenced this pull request Oct 21, 2026
From jolicode/docker-starter#461: without a terminal (CI, pipes, AI agents), a prompt in the container waited forever.
@lyrixx
lyrixx marked this pull request as draft October 21, 2026 10:20
Since #453, docker_compose_run() and docker_compose_exec() keep the PTY of
the context. Without a terminal (CI, pipes, AI agents...), the command gets a
terminal nobody types in, and a prompt waits forever (e.g. composer audit
asking to trust a plugin). The default context now gives a PTY only when stdin
is a terminal, outside of a CI.

A CTRL+C followed by a CTRL+D in the shell of `castor builder` no longer stops
the task as interrupted: the shell exits with the code of its last command,
130, which Castor 1.9 takes for a CTRL+C.

The terminal tests move from the workflow to `castor test:terminal`, and the
tests of docker-starter to the `test` namespace. Castor 1.9 is required, for
its detection of non-interactive environments.
@lyrixx
lyrixx force-pushed the fix-docker-pty-without-terminal branch from 84c20e7 to 58e5947 Compare October 21, 2026 11:55
@lyrixx
lyrixx marked this pull request as ready for review October 21, 2026 12:03
@lyrixx
lyrixx requested review from joelwurtz and pyrech October 21, 2026 12:03
@lyrixx
lyrixx merged commit fbf4618 into main Oct 21, 2026
5 checks passed
@lyrixx
lyrixx deleted the fix-docker-pty-without-terminal branch October 21, 2026 12:13
lyrixx added a commit to jolicode/qotd that referenced this pull request Oct 21, 2026
From jolicode/docker-starter#461: commands only get a PTY when someone can answer their prompts (stdin is a terminal, outside of a CI), otherwise a prompt waited forever. Castor 1.9.0 is now required, for the trapped signals of the interactive shells.
lyrixx added a commit to jolicode/monologue that referenced this pull request Oct 21, 2026
From jolicode/docker-starter#461: commands only get a PTY when someone can answer their prompts (stdin is a terminal, outside of a CI), otherwise a prompt waited forever. Castor 1.9.0 is now required, for the trapped signals of the interactive shells.
lyrixx added a commit to beberlei/metrics that referenced this pull request Oct 21, 2026
From jolicode/docker-starter#461, replacing the previous fix: run() also got a PTY without a terminal, and a piped stdout lost it. Castor 1.9.0 is now required, for the trapped signals of the interactive shells.
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.

2 participants