def test_os_kill(self): import subprocess import signal proc = subprocess.Popen([sys.executable, "-c", "import time;" "time.sleep(10)", ], ) rposix.kill(proc.pid, signal.SIGTERM) if os.name == 'nt': expected = signal.SIGTERM else: expected = -signal.SIGTERM assert proc.wait() == expected
def abort(space): """Abort the interpreter immediately. This 'dumps core' or otherwise fails in the hardest way possible on the hosting operating system.""" import signal rposix.kill(os.getpid(), signal.SIGABRT)
def kill(space, pid, sig): "Kill a process with a signal." try: rposix.kill(pid, sig) except OSError as e: raise wrap_oserror(space, e)