Skip to content

Commit

Permalink
Merge pull request #1292 from DavidHayden87/stdin-prompts
Browse files Browse the repository at this point in the history
Make user prompts work with redirected stdin
  • Loading branch information
forki committed Dec 6, 2015
2 parents 1962a12 + 42a5486 commit cd1ec7b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Paket.Core/Utils.fs
Original file line number Diff line number Diff line change
Expand Up @@ -280,15 +280,15 @@ let safeGetFromUrl (auth:Auth option, url : string, contentType : string) =
with _ -> return None
}

let readKey() = System.Console.ReadKey().KeyChar.ToString()
let readAnswer() = System.Console.ReadLine().Trim()

/// If the guard is true then a [Y]es / [N]o question will be ask.
/// Until the user pressed y or n.
let askYesNo question =
let rec getAnswer() =
Logging.tracefn "%s" question
Logging.tracef " [Y]es/[N]o => "
let answer = readKey()
let answer = readAnswer()
Logging.tracefn ""
match answer.ToLower() with
| "y" -> true
Expand Down

0 comments on commit cd1ec7b

Please sign in to comment.