Program stalls when called via Popen4?

Ulrich Petri ulope at
Fri Mar 21 00:08:58 CET 2003

"Joshua Pollak" <joshp at> schrieb im Newsbeitrag
news:Vrqea.6493$io.248058 at
> Hello,
> I'm writing an autobuild script for internal use at my company. Its
> to check our code out of our source control system, call our build system,
> then run our unit tests and email the results to a developer.
> Everything seems to be working correctly, EXCEPT that the popen2.Popen4
> instance I'm using to actually build our project never returns. When I
> 'watch' what the subprocess is doing by using 'ps aux', it seems that it
> has stalled on the first call to 'echo'! I'm not sure how to debug this
> because when I try to duplicate the results manually, everything works
> fine.
> Here is the relevant code:
> compileCommand = self.params["SetupCmd"] + " &&
> compileProcess =  popen2.Popen4(compileCommand)

Do you read the output of compileProcess?
If not the buffer of the pipe will fill and then block the child.

You can use something like this:

data =
while 1:
    if data == "":
        ret = compileProcess.poll()
        if ret != -1:
    ret =

Of course you can increase the amount of data to be read at a time (e.g.

Ciao Ulrich

More information about the Python-list mailing list