Set the terminal to raw mode *before* printing the prompt.
Otherwise the user (or the automated test) might enter the
passphrase before the terminal gets put into raw mode.
This is needed for some of the CLI tests to pass reliably in Travis CI.
// passphrase into a key. If we are not reading from a terminal, just read into
// the passphrase into the key normally.
func getPassphraseKey(prompt string) (*crypto.Key, error) {
- if !quietFlag.Value {
- fmt.Print(prompt)
- }
// Only disable echo if stdin is actually a terminal.
if terminal.IsTerminal(stdinFd) {
}()
}
+ if !quietFlag.Value {
+ fmt.Print(prompt)
+ }
+
return crypto.NewKeyFromReader(passphraseReader{})
}