| 1 | import multiprocessing |
| 2 | |
| 3 | def foo(conn): |
| 4 | conn.send("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 | |
| 10 | r, w = multiprocessing.Pipe(False) |
| 11 | p = multiprocessing.Process(target=foo, args=(w,)) |
| 12 | p.start() |
| 13 | w.close() |
| 14 | print(r.recv()) |
| 15 | r.close() |
| 16 | p.join() |