os: Add fork()/pipe() test.

pull/118/head
Paul Sokolovsky 2014-05-01 02:44:09 +03:00
rodzic c0ab28571b
commit 8e3ce63a8d
1 zmienionych plików z 17 dodań i 0 usunięć

17
os/test_fork.py 100644
Wyświetl plik

@ -0,0 +1,17 @@
import os
r, w = os.pipe()
print(r, w)
pid = os.fork()
print("hello", pid)
if not pid:
print("pid:", os.getpid())
os.close(r)
os.write(w, "from child")
os._exit(0)
else:
os.close(w)
print(os.read(r, 100))
print(os.waitpid(pid, 0))