aboutsummaryrefslogtreecommitdiff
path: root/ask
diff options
context:
space:
mode:
authorDimitri Sokolyuk <demon@dim13.org>2017-04-30 23:46:21 +0200
committerDimitri Sokolyuk <demon@dim13.org>2017-04-30 23:46:21 +0200
commitfb2a33a31f388395379768dfe72b3b83d8a6f02d (patch)
tree3473731e7fc2597f3edbcabf45c676f546d3091d /ask
parent6d5a1fdf604c376a2e6bcde0ec3b0a77682db768 (diff)
fd
Diffstat (limited to 'ask')
-rw-r--r--ask/ask.go5
1 files changed, 3 insertions, 2 deletions
diff --git a/ask/ask.go b/ask/ask.go
index 76a20cc..9a45b30 100644
--- a/ask/ask.go
+++ b/ask/ask.go
@@ -32,11 +32,12 @@ func Password() (string, error) {
}
func ask(f *os.File, prompt string) (string, error) {
- oldState, err := terminal.MakeRaw(int(f.Fd()))
+ fd := int(f.Fd())
+ oldState, err := terminal.MakeRaw(fd)
if err != nil {
return "", err
}
- defer terminal.Restore(int(f.Fd()), oldState)
+ defer terminal.Restore(fd, oldState)
term := terminal.NewTerminal(f, "")
pass, err := term.ReadPassword(prompt)