Advertisement
Guest User

Untitled

a guest
Aug 21st, 2015
178
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.83 KB | None | 0 0
  1. root@cpc304:~# cat yoba.py
  2. import os
  3.  
  4.  
  5. pid = os.fork()
  6. if pid:
  7.  
  8. print("parent")
  9. os.waitpid(pid, 0)
  10.  
  11. else:
  12.  
  13. print("child")
  14. root@cpc304:~# python yoba.py
  15. parent
  16. child
  17. root@cpc304:~# python3 --version
  18. Python 3.4.3
  19. root@cpc304:~# python3 yoba.py
  20. parent
  21. Traceback (most recent call last):
  22. File "yoba.py", line 8, in <module>
  23. os.waitpid(pid, 0)
  24. ChildProcessError: [Errno 10] No child processes
  25. root@cpc304:~#
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement