fix: allow -t flag to be used independently in compose run - #5149
fix: allow -t flag to be used independently in compose run#5149wryyyds7 wants to merge 1 commit into
Conversation
95ff242 to
b558f87
Compare
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' - For backward compatibility, when -t is not explicitly set, it follows -i (preserving existing behavior) - Removes the restriction that StdinOpen and Tty must be equal in up_service.go AND create.go - Allows -i and -t to be specified independently Ref: containerd#1604 Signed-off-by: wryyyds7 <2414898121@qq.com>
b558f87 to
9b77ad9
Compare
CI Status UpdateThe compose-related test failures from the previous CI run have been fixed. The fix adds backward compatibility: when Compose tests: all passing ✅
Remaining CI failures: known flaky tests (unrelated to this PR)The 4 remaining failing jobs are all known flaky tests:
These failures also appear on other merged PRs (e.g., #5130 has the same No code changes are needed for these flaky tests. |
Did you run some manual verification too? |
|
Yes, I ran manual verification. I compiled both the original and modified binaries and ran 30 comparison test cases covering different combinations of 11 tests showed differences — all cases where the original rejected
20 tests showed no difference — confirming no regression (e.g., The key verification: after the fix, |
What this PR does
Previously,
-t(tty) was not available as a standalone flag innerdctl 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-tor--ttywould result inunknown flagerror.This PR:
-t/--ttyflag tocompose runStdinOpenandTtymust be equal inup_service.go-iand-tto be specified independentlyChanges
cmd/nerdctl/compose/compose_run.go: Added-t/--ttyflag, changedttyfrom= interactiveto independentcmd.Flags().GetBool("tty")pkg/composer/up_service.go: RemovedStdinOpen != Ttyerror checkVerification
Compiled both original and modified binaries, ran 30 test cases comparing behavior:
-tbut modified version accepts itRef: #1604