Program stalls when called via Popen4?
ulope at gmx.de
Fri Mar 21 12:27:09 CET 2003
"Ulrich Petri" <ulope at gmx.de> schrieb im Newsbeitrag
news:b5dhmj$27s8ul$1 at ID-67890.news.dfncis.de...
> "Joshua Pollak" <joshp at cra.com> schrieb im Newsbeitrag
> news:Vrqea.6493$io.248058 at iad-read.news.verio.net...
> > 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
> > 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 = compileProcess.fromchild.read(1)
> while 1:
> if data == "":
> ret = compileProcess.poll()
> if ret != -1:
> ret = compileProcess.read(1)
> Of course you can increase the amount of data to be read at a time (e.g.
Oooops the last line of course has to read:
data = compileProcess.fromchild.read(1)
More information about the Python-list