def testProcessDiesAfterBeingTracked(self): p = BetterPopen(["sleep", "1"]) zombieReaper.autoReapPID(p.pid) # wait for the grim reaper to arrive sleep(4) # Throws error because pid is not found or is not child self.assertRaises(OSError, os.waitpid, p.pid, os.WNOHANG)
def testProcessDiedBeforeBeingTracked(self): p = BetterPopen(["sleep", "0"]) # wait for the process to die sleep(1) zombieReaper.autoReapPID(p.pid) # Throws error because pid is not found or is not child self.assertRaises(OSError, os.waitpid, p.pid, os.WNOHANG)
def stop(self): try: os.kill(self.process.pid, signal.SIGKILL) except: pass try: zombieReaper.autoReapPID(self.process.pid) except AttributeError: if zombieReaper is not None: raise
def stop(self): try: os.kill(self.process.pid, signal.SIGKILL) except: pass self.process.poll() # Don't try to read if the process is in D state if (self.process.returncode is not None and self.process.returncode != 0): err = self.process.stderr.read() out = self.process.stdout.read() self.log.debug("Pool handler existed, OUT: '%s' ERR: '%s'", out, err) try: zombieReaper.autoReapPID(self.process.pid) except AttributeError: if zombieReaper is not None: raise