From f29d7a480f878358d5f39839ee3300fed7661a07 Mon Sep 17 00:00:00 2001 From: Aaron Meihm Date: Fri, 3 Feb 2017 10:52:30 -0600 Subject: [PATCH] =?UTF-8?q?[minor]=20update=20pgp=20getPINNa=C3=AFve=20so?= =?UTF-8?q?=20stty=20-echo=20is=20successful?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit See #316 for additional details --- pgp/pinentry/pinentry.go | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/pgp/pinentry/pinentry.go b/pgp/pinentry/pinentry.go index a930726d..3bd5c315 100644 --- a/pgp/pinentry/pinentry.go +++ b/pgp/pinentry/pinentry.go @@ -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 != "" {