gpg extension: Always remove temporary files created by 'hg sigcheck'.
authorThomas Arendsen Hein <thomas@intevation.de>
Tue, 09 May 2006 13:26:16 +0200
changeset 2231 9a2f4b2e7cf1
parent 2230 332950340788
child 2232 ef3c039e7ab8
child 2239 5e5adc1910ed
gpg extension: Always remove temporary files created by 'hg sigcheck'.
hgext/gpg.py
--- a/hgext/gpg.py	Mon May 08 16:50:27 2006 -0700
+++ b/hgext/gpg.py	Tue May 09 13:26:16 2006 +0200
@@ -21,6 +21,7 @@
 
     def verify(self, data, sig):
         """ returns of the good and bad signatures"""
+        sigfile = datafile = None
         try:
             # create temporary files
             fd, sigfile = tempfile.mkstemp(prefix="hg-gpg-", suffix=".sig")
@@ -34,12 +35,11 @@
             gpgcmd = ("%s --logger-fd 1 --status-fd 1 --verify "
                       "\"%s\" \"%s\"" % (self.path, sigfile, datafile))
             ret = util.filter("", gpgcmd)
-        except:
+        finally:
             for f in (sigfile, datafile):
                 try:
                     if f: os.unlink(f)
                 except: pass
-            raise
         keys = []
         key, fingerprint = None, None
         err = ""