Skip to content

Instantly share code, notes, and snippets.

@schipiga
Last active January 30, 2020 20:02
Show Gist options
  • Save schipiga/143751d133a4624157d88dfe66706b17 to your computer and use it in GitHub Desktop.
Save schipiga/143751d133a4624157d88dfe66706b17 to your computer and use it in GitHub Desktop.
import time
from multiprocessing import Process
def target():
raise Exception('BOOM!')
def main():
proc = Process(target=target)
proc.start()
time.sleep(1)
print('Is process alive?', proc.is_alive())
proc._popen.returncode = None # reset cached exit code
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