"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
sys.stdout.write('hello')
if correct: sys.stdout.flush()
if os.fork() == 0: sys.stdout.write('\n')
------------------------------------------------------------------------

Jeff

Attachment: pgpDFwCkshuhD.pgp
Description: PGP signature

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to