Processes and their childs

Jeff Epler jepler at
Tue Dec 21 15:24:26 CET 2004

"flush" your files before forking.

For me, this program gives the correct output 'hello\n' when correct=1.  
When correct=0, I get either 'hello\nhello' or 'hellohello\n' as output.

correct = 0
import sys, os
if correct: sys.stdout.flush()
if os.fork() == 0: sys.stdout.write('\n')

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
URL: <>

More information about the Python-list mailing list