From 4ec95b5de109fb73288c1301a38eac779517a2ac Mon Sep 17 00:00:00 2001 From: Dominique Martinet Date: Thu, 28 May 2026 16:51:56 +0900 Subject: [PATCH] cmd/podman: don't warn on `podman run -ti -d` from not a tty `podman run -ti` warns when stdin is not a tty, but if the container is run in detached state that warning does not make much sense: we just need the environment where podman attach will be run to be a tty. Running with `-ti` even in detached state can make sense to avoid applications buffering their output (for realtime logs) or allowing later interaction and should not warn users. Also remove the comment saying that warning will become fatal, as there seems to be agreement that such a breaking change will not be made Signed-off-by: Dominique Martinet --- cmd/podman/containers/run.go | 4 ++-- test/e2e/exec_test.go | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/cmd/podman/containers/run.go b/cmd/podman/containers/run.go index 3e58c6e628..a6d5b89f05 100644 --- a/cmd/podman/containers/run.go +++ b/cmd/podman/containers/run.go @@ -116,8 +116,8 @@ func run(cmd *cobra.Command, args []string) error { } cliVals.Rm = true } - // TODO: Breaking change should be made fatal in next major Release - if cliVals.TTY && cliVals.Interactive && !term.IsTerminal(int(os.Stdin.Fd())) { + + if cliVals.TTY && cliVals.Interactive && !runOpts.Detach && !term.IsTerminal(int(os.Stdin.Fd())) { logrus.Warnf("The input device is not a TTY. The --tty and --interactive flags might not work properly") } diff --git a/test/e2e/exec_test.go b/test/e2e/exec_test.go index 7f72c8c78a..4009445d1e 100644 --- a/test/e2e/exec_test.go +++ b/test/e2e/exec_test.go @@ -342,11 +342,12 @@ var _ = Describe("Podman exec", func() { // #10927 ("no logs from conmon"), one of our nastiest flakes It("podman exec terminal doesn't hang", FlakeAttempts(3), func() { - setup := podmanTest.Podman([]string{"run", "-dti", "--name", "test1", FEDORA_MINIMAL, "sleep", "+Inf"}) + setup := podmanTest.Podman([]string{"run", "-ti", "--rm", "--name", "test1", FEDORA_MINIMAL, "true"}) setup.WaitWithDefaultTimeout() Expect(setup).Should(Exit(0)) Expect(setup.ErrorToString()).To(ContainSubstring("The input device is not a TTY. The --tty and --interactive flags might not work properly")) + podmanTest.PodmanExitCleanly("run", "-dti", "--name", "test1", FEDORA_MINIMAL, "sleep", "+Inf") for range 5 { session := podmanTest.Podman([]string{"exec", "-ti", "test1", "true"}) session.WaitWithDefaultTimeout()