Windows: Prompt fix

Signed-off-by: John Howard <jhoward@microsoft.com>
This commit is contained in:
John Howard 2016-12-09 14:21:45 -08:00
parent f099e134e4
commit 1da163febe
1 changed files with 6 additions and 0 deletions

View File

@ -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") {