def killpg(sig): """Attempt to send `signal` to the progress group of `pid`. If `pid` is running in the same process group as the invoking process, this falls back to using kill(2) instead of killpg(2). """ try: pgid = os.getpgid(pid) if pgid == ppgid: _os_kill(pid, sig) else: _os_killpg(pgid, sig) except ProcessLookupError: pass # Already exited.
def kill(sig): """Attempt to send `signal` to the given `pid`.""" try: _os_kill(pid, sig) except ProcessLookupError: pass # Already exited.
def quitTerminal(): input("This is Cool !! Press Enter to Exit ...") _os_kill(_os_getppid(), _SIGHUP)