Skip to content

Commit fd34976

Browse files
committed
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]: moby/moby@30b8f08 [cli@37ccc00]: 37ccc00 Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
1 parent 40a8e8e commit fd34976

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

internal/prompt/prompt.go

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,18 @@ func Confirm(ctx context.Context, in io.Reader, out io.Writer, message string) (
8888
_, _ = out.Write([]byte(message))
8989

9090
// On Windows, force the use of the regular OS stdin stream.
91+
//
92+
// StdStreams() may wrap stdin with windowsconsole.NewAnsiReader to
93+
// emulate VT input on consoles that do not support it natively, but
94+
// that wrapper has historically caused interactive prompts to hang
95+
// or behave incorrectly.
96+
//
97+
// See:
98+
// - https://github.com/moby/moby/issues/14336
99+
// - https://github.com/moby/moby/issues/14210
100+
// - https://github.com/moby/moby/pull/17738
91101
if runtime.GOOS == "windows" {
92-
in = streams.NewIn(os.Stdin)
102+
in = os.Stdin
93103
}
94104

95105
result := make(chan bool)

0 commit comments

Comments
 (0)