From fd3497683d01d768149f1ee4088190ea9d77f1ec Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Tue, 7 Jul 2026 14:17:53 +0200 Subject: [PATCH] internal/prompt: Confirm: don't wrap stdIn This was a remnant from when `PromptForConfirmation` accepted a `InStream`; it was added in [moby@30b8f08], which got left behind when [cli@37ccc00] updated its signature to accept a plain `io.Reader`. While updating, also update the comment to provide more context on the reason we're unconditionally using `os.Stdin` on Windows. [moby@30b8f08]: https://github.com/moby/moby/commit/30b8f084436a2a1d5e8523fcd2c5ea64cc805224 [cli@37ccc00]: https://github.com/docker/cli/commit/37ccc00d0e14461bcf29e98669773625dfed2fce Signed-off-by: Sebastiaan van Stijn --- internal/prompt/prompt.go | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/internal/prompt/prompt.go b/internal/prompt/prompt.go index 4d47a10e6b7a..58b6bbc17587 100644 --- a/internal/prompt/prompt.go +++ b/internal/prompt/prompt.go @@ -88,8 +88,18 @@ func Confirm(ctx context.Context, in io.Reader, out io.Writer, message string) ( _, _ = out.Write([]byte(message)) // On Windows, force the use of the regular OS stdin stream. + // + // StdStreams() may wrap stdin with windowsconsole.NewAnsiReader to + // emulate VT input on consoles that do not support it natively, but + // that wrapper has historically caused interactive prompts to hang + // or behave incorrectly. + // + // See: + // - https://github.com/moby/moby/issues/14336 + // - https://github.com/moby/moby/issues/14210 + // - https://github.com/moby/moby/pull/17738 if runtime.GOOS == "windows" { - in = streams.NewIn(os.Stdin) + in = os.Stdin } result := make(chan bool)