[minor] update pgp getPINNaïve so stty -echo is successful

See #316 for additional details
This commit is contained in:
Aaron Meihm 2017-02-03 10:52:30 -06:00
Родитель fb040623d8
Коммит f29d7a480f
1 изменённых файлов: 8 добавлений и 3 удалений

Просмотреть файл

@ -118,10 +118,12 @@ func (r *Request) GetPIN() (pin string, outerr error) {
return "", fmt.Errorf("GETPIN response didn't start with D; got %q", line)
}
func runPass(bin string, args ...string) {
func runPass(bin string, args ...string) error {
cmd := exec.Command(bin, args...)
cmd.Stdin = os.Stdin
cmd.Stdout = os.Stdout
cmd.Run()
cmd.Stderr = os.Stderr
return cmd.Run()
}
func (r *Request) getPINNaïve() (string, error) {
@ -129,7 +131,10 @@ func (r *Request) getPINNaïve() (string, error) {
if err != nil {
return "", errors.New("no pinentry or stty found")
}
runPass(stty, "-echo")
err = runPass(stty, "-echo")
if err != nil {
return "", fmt.Errorf("error running stty: %v", err)
}
defer runPass(stty, "echo")
if r.Desc != "" {