diff options
Diffstat (limited to 'lib/crypto/gpg')
-rw-r--r-- | lib/crypto/gpg/gpgbin/decrypt.go | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/crypto/gpg/gpgbin/decrypt.go b/lib/crypto/gpg/gpgbin/decrypt.go index fd11b755..09626303 100644 --- a/lib/crypto/gpg/gpgbin/decrypt.go +++ b/lib/crypto/gpg/gpgbin/decrypt.go @@ -18,7 +18,11 @@ func Decrypt(r io.Reader) (*models.MessageDetails, error) { } args := []string{"--decrypt"} g := newGpg(bytes.NewReader(orig), args) - err = g.cmd.Run() + _ = g.cmd.Run() + outRdr := bytes.NewReader(g.stdout.Bytes()) + // Always parse stdout, even if there was an error running command. + // We'll find the error in the parsing + err = parse(outRdr, md) if err != nil { err = parseError(g.stderr.String()) switch GPGErrors[err.Error()] { @@ -29,7 +33,5 @@ func Decrypt(r io.Reader) (*models.MessageDetails, error) { return nil, err } } - outRdr := bytes.NewReader(g.stdout.Bytes()) - parse(outRdr, md) return md, nil } |