blob: 017e010ba0e6fd4372356e7c2bef5b0f23717c1a [file] [log] [blame]
Richard Oudkerke88a2442012-08-14 11:41:32 +01001import multiprocessing, sys
2
3def foo():
4 print("123")
5
6# Because "if __name__ == '__main__'" is missing this will not work
7# correctly on Windows. However, we should get a RuntimeError rather
8# than the Windows equivalent of a fork bomb.
9
Richard Oudkerk84ed9a62013-08-14 15:35:41 +010010if len(sys.argv) > 1:
11 multiprocessing.set_start_method(sys.argv[1])
12else:
13 multiprocessing.set_start_method('spawn')
14
Richard Oudkerke88a2442012-08-14 11:41:32 +010015p = multiprocessing.Process(target=foo)
16p.start()
17p.join()
18sys.exit(p.exitcode)