def response(box, resp): reply.append(resp) g.mainquit()
assert self.done is True or isinstance(self.done, Exception) if self.done is True: # Success # If dst wasn't a fileno stream, copy from the temp file to it if self.tmp_stream: self.tmp_stream.seek(0) self.dst.write(self.tmp_stream.read()) self.tmp_stream = None if self.waiting: assert self.done self.waiting = False g.mainquit() def wait(self): """Run a recursive mainloop until the command terminates. Raises an exception on error.""" if self.child is None: self.start() self.waiting = True while not self.done: g.mainloop() if self.done is not True: raise self.done def kill(self, sig = signal.SIGTERM): self.killed = 1 Process.kill(self, sig)
assert self.done is True or isinstance(self.done, Exception) if self.done is True: # Success # If dst wasn't a fileno stream, copy from the temp file to it if self.tmp_stream: self.tmp_stream.seek(0) self.dst.write(self.tmp_stream.read()) self.tmp_stream = None if self.waiting: assert self.done self.waiting = False g.mainquit() def wait(self): """Run a recursive mainloop until the command terminates. Raises an exception on error.""" if self.child is None: self.start() self.waiting = True while not self.done: g.mainloop() if self.done is not True: raise self.done def kill(self, sig=signal.SIGTERM): self.killed = 1 Process.kill(self, sig)