Mercurial > hg > bnpparibas
diff src/bnpparibas.py @ 4:b4c2db70bbf2
Detect and report gpg invocations errors
author | Daniele Nicolodi <daniele@grinta.net> |
---|---|
date | Wed, 25 Mar 2015 01:38:07 +0100 |
parents | 1311f6533978 |
children | a47012c9db15 |
line wrap: on
line diff
--- a/src/bnpparibas.py Wed Feb 25 01:44:50 2015 +0100 +++ b/src/bnpparibas.py Wed Mar 25 01:38:07 2015 +0100 @@ -404,7 +404,9 @@ cmd = [ "gpg", "--homedir", self.homedir, "--batch", "--yes", "--no-options", "--armor", "--local-user", sender, "--recipient", recipient, "--sign", "--encrypt"] p = subprocess.Popen(cmd, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE) - encdata = p.communicate(input=message.encode('utf-8'))[0].decode('ascii') + encdata, err = p.communicate(input=message.encode('utf-8'))[0].decode('ascii') + if p.returncode: + raise RuntimeError(p.returncode, err) return encdata