def broken_script_pipe(signum, frame): try: self.processes[self.processes.socket].finish() except: ... process.killall() sys.exit() # Not os._exit
def terminate(signum, frame): # self.processes.empty() # @@ Actually could be another user sending the signal user = os.environ.get("USER", "a signal") signame = signames.get(signum, signum) message = "%s made me do it (%s)" % (user, signame) self.public.send("QUIT", message) # This calls .finish(), so the QUIT above should work self.processes.stop() # Stop any stray commands, potentially corrupting queues try: self.commands.collect(0) except: ... # Send SIGKILL to any remaining processes that we know of process.killall() # Since we're exiting, we don't need to mop up process queues os._exit(0)