Last active
December 6, 2019 15:20
-
-
Save schipiga/d021d23eeb06951cff77fcc70f4670be to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from multiprocessing import Process | |
import time | |
import signal | |
import os | |
import psutil | |
def start(): | |
raise Exception('BOOM!') | |
def handle_chld(signum, frame): | |
os.waitpid(-1, os.WNOHANG) | |
signal.signal(signal.SIGCHLD, handle_chld) | |
def main(): | |
proc = Process(target=start) | |
proc.start() | |
time.sleep(1) | |
print('is process alive?', psutil.pid_exists(proc.pid)) | |
print('is process alive?', proc.is_alive()) | |
if __name__ == '__main__': | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment