Re: [Python-Dev] Forking and pipes

2008-12-09 Thread Greg Ewing
Lars Kotthoff wrote: This prints out "foo" twice although it's only written once to the pipe. It seems that python doesn't flush file descriptors before copying them to the child process, thus resulting in the duplicate message. The equivalent C program behaves as expected, Your Python and C p

Re: [Python-Dev] Forking and pipes

2008-12-09 Thread Alexander Shigin
В Втр, 09/12/2008 в 19:26 +, Lars Kotthoff пишет: > Dear list, > > I recently noticed a python program which uses forks and pipes for > communication between the processes not behaving as expected. The minimal > example program: If you write r, w = os.pipe() os.write(w, 'foo') pid = os

Re: [Python-Dev] Forking and pipes

2008-12-09 Thread James Y Knight
On Dec 9, 2008, at 2:26 PM, Lars Kotthoff wrote: Dear list, I recently noticed a python program which uses forks and pipes for communication between the processes not behaving as expected. The minimal example program: [snip] This prints out "foo" twice although it's only written once to

[Python-Dev] Forking and pipes

2008-12-09 Thread Lars Kotthoff
Dear list, I recently noticed a python program which uses forks and pipes for communication between the processes not behaving as expected. The minimal example program: #!/usr/bin/python import os, sys r, w = os.p