]> git.decadent.org.uk Git - dak.git/blobdiff - daklib/gpg.py
end() is not defined in daklib/queue.py
[dak.git] / daklib / gpg.py
index 90103afa0ddc20ae98457e34314d0407714f2f8b..865e9bd6dccc13b9b47354c510fa9c5503f2ab8c 100644 (file)
@@ -23,7 +23,6 @@ import errno
 import fcntl
 import os
 import select
-import sys
 
 try:
     _MAXFD = os.sysconf("SC_OPEN_MAX")
@@ -69,7 +68,7 @@ class SignedFile(object):
     def __init__(self, data, keyrings, require_signature=True, gpg="/usr/bin/gpg"):
         """
         @param data: string containing the message
-        @param keyrings: seqeuence of keyrings
+        @param keyrings: sequence of keyrings
         @param require_signature: if True (the default), will raise an exception if no valid signature was found
         @param gpg: location of the gpg binary
         """
@@ -115,6 +114,10 @@ class SignedFile(object):
                     raise GpgException("No valid signature found. (GPG exited with status code %s)\n%s" % (exit_code, self.stderr))
 
     def _do_io(self, read, write):
+        for fd in write.keys():
+            old = fcntl.fcntl(fd, fcntl.F_GETFL)
+            fcntl.fcntl(fd, fcntl.F_SETFL, old | os.O_NONBLOCK)
+
         read_lines = dict( (fd, []) for fd in read )
         write_pos = dict( (fd, 0) for fd in write )
 
@@ -185,6 +188,6 @@ class SignedFile(object):
 
             os.execvp(self.gpg, args)
         finally:
-            sys.exit(1)
+            os._exit(1)
 
 # vim: set sw=4 et: