Browse code

Windows: Prompt fix

Signed-off-by: John Howard <jhoward@microsoft.com>

John Howard authored on 2016/12/10 07:21:45
Showing 1 changed files
... ...
@@ -6,6 +6,7 @@ import (
6 6
 	"io/ioutil"
7 7
 	"os"
8 8
 	"path/filepath"
9
+	"runtime"
9 10
 	"strings"
10 11
 )
11 12
 
... ...
@@ -71,6 +72,11 @@ func PromptForConfirmation(ins *InStream, outs *OutStream, message string) bool
71 71
 
72 72
 	fmt.Fprintf(outs, message)
73 73
 
74
+	// On Windows, force the use of the regular OS stdin stream.
75
+	if runtime.GOOS == "windows" {
76
+		ins = NewInStream(os.Stdin)
77
+	}
78
+
74 79
 	answer := ""
75 80
 	n, _ := fmt.Fscan(ins, &answer)
76 81
 	if n != 1 || (answer != "y" && answer != "Y") {