Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- root@cpc304:~# cat yoba.py
- import os
- pid = os.fork()
- if pid:
- print("parent")
- os.waitpid(pid, 0)
- else:
- print("child")
- root@cpc304:~# python yoba.py
- parent
- child
- root@cpc304:~# python3 --version
- Python 3.4.3
- root@cpc304:~# python3 yoba.py
- parent
- Traceback (most recent call last):
- File "yoba.py", line 8, in <module>
- os.waitpid(pid, 0)
- ChildProcessError: [Errno 10] No child processes
- root@cpc304:~#
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement