From a586c34f9912c80d67efca97d3986b5fdfa1ce77 Mon Sep 17 00:00:00 2001 From: John Howard Date: Fri, 9 Dec 2016 14:21:45 -0800 Subject: [PATCH] Windows: Prompt fix Signed-off-by: John Howard Upstream-commit: 30b8f084436a2a1d5e8523fcd2c5ea64cc805224 Component: engine --- components/engine/cli/command/utils.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/components/engine/cli/command/utils.go b/components/engine/cli/command/utils.go index 9f9a1ee80d..1837ca41f0 100644 --- a/components/engine/cli/command/utils.go +++ b/components/engine/cli/command/utils.go @@ -6,6 +6,7 @@ import ( "io/ioutil" "os" "path/filepath" + "runtime" "strings" ) @@ -71,6 +72,11 @@ func PromptForConfirmation(ins *InStream, outs *OutStream, message string) bool fmt.Fprintf(outs, message) + // On Windows, force the use of the regular OS stdin stream. + if runtime.GOOS == "windows" { + ins = NewInStream(os.Stdin) + } + answer := "" n, _ := fmt.Fscan(ins, &answer) if n != 1 || (answer != "y" && answer != "Y") {