Procházet zdrojové kódy

Windows: Prompt fix

Signed-off-by: John Howard <jhoward@microsoft.com>
John Howard před 8 roky
rodič
revize
30b8f08443
1 změnil soubory, kde provedl 6 přidání a 0 odebrání
  1. 6 0
      cli/command/utils.go

+ 6 - 0
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") {