Processes and their childs

Jeff Epler jepler at unpythonic.net
Tue Dec 21 09:24:26 EST 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
sys.stdout.write('hello')
if correct: sys.stdout.flush()
if os.fork() == 0: sys.stdout.write('\n')
------------------------------------------------------------------------

Jeff
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/python-list/attachments/20041221/cdde3636/attachment.sig>


More information about the Python-list mailing list