SHARE
TWEET

Untitled

a guest Aug 21st, 2015 132 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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:~#
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top