Merge pull request #705 from hashicorp/b-password-interrupt

helper/password: interrupt should exit readline
This commit is contained in:
Mitchell Hashimoto 2015-10-16 16:20:58 -07:00
commit aecb13394c
1 changed files with 7 additions and 0 deletions

View File

@ -50,6 +50,13 @@ func readline(f *os.File) (string, error) {
break
}
// ASCII code 3 is what is sent for a Ctrl-C while reading raw.
// If we see that, then get the interrupt. We have to do this here
// because terminals in raw mode won't catch it at the shell level.
if buf[0] == 3 {
return "", ErrInterrupted
}
resultBuf = append(resultBuf, buf[0])
}