Skip to content

fix: allow -t flag to be used independently in compose run - #5149

Open
wryyyds7 wants to merge 1 commit into
containerd:mainfrom
wryyyds7:fix/compose-run-t-flag
Open

fix: allow -t flag to be used independently in compose run#5149
wryyyds7 wants to merge 1 commit into
containerd:mainfrom
wryyyds7:fix/compose-run-t-flag

Conversation

@wryyyds7

Copy link
Copy Markdown

What this PR does

Previously, -t (tty) was not available as a standalone flag in nerdctl compose run — it was hardcoded to follow -i (interactive). This meant users could not allocate a TTY without also enabling STDIN, and any use of -t or --tty would result in unknown flag error.

This PR:

  • Adds a standalone -t/--tty flag to compose run
  • Removes the restriction that StdinOpen and Tty must be equal in up_service.go
  • Allows -i and -t to be specified independently

Changes

  • cmd/nerdctl/compose/compose_run.go: Added -t/--tty flag, changed tty from = interactive to independent cmd.Flags().GetBool("tty")
  • pkg/composer/up_service.go: Removed StdinOpen != Tty error check

Verification

Compiled both original and modified binaries, ran 30 test cases comparing behavior:

  • 11 tests showed differences — all cases where original rejected -t but modified version accepts it
  • 20 tests showed no difference — confirming no regression in existing behavior
Allow `-t/--tty` flag to be used independently in `nerdctl compose run`.

Ref: #1604

Previously, -t (tty) was not available as a standalone flag in
'nerdctl compose run' — it was hardcoded to follow -i (interactive).
This meant users could not allocate a TTY without also enabling
STDIN, and any use of -t or --tty would result in 'unknown flag'.

This change:
- Adds a standalone -t/--tty flag to 'compose run'
- Removes the restriction that StdinOpen and Tty must be equal
- Allows -i and -t to be specified independently

Ref: containerd#1604

Signed-off-by: wryyyds7 <wry@code.alipay.com>
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.

1 participant