Re: subprocess & redirect

"Jonathan Ellis" <[email protected]>
Newsgroups gmane.comp.python.spyce.general
Message-ID <[email protected]>
On Wed, 29 Mar 2006 23:28:25 -0500, "Philip Semanchuk"
<[email protected]> said:
> On Mar 22, 2006, at 6:45 PM, Philip Semanchuk wrote:
> > On Mar 21, 2006, at 4:45 PM, Jonathan Ellis wrote:
> >
> >> Strange.  My first guess would be that the child process is somehow
> >> interacting with stdout (which Spyce redirects to an internal file
> >> handle) which screws things up here.  But even when I specify
> >> subprocess.PIPE for the subprocess stdin/out/err I get the same 
> >> results.
> >>  So I don't know.  Let me know if you figure it out. :)
> 
> Jonathan,
> You were correct, although it wasn't stdout that was the problem (even 
> though that makes the most sense). If I supply the parameter 
> "close_fds=True" to subprocess.Popen(), the problem goes away. The 
> documentation says, "If close_fds is true, all file descriptors except 
> 0, 1 and 2 will be closed before the child process is executed." So it 
> sounds like the child process was holding open some file and Spyce's 
> processing couldn't complete until the child exited and the file was 
> closed.

Hey, great!  Glad you figured out what was going on.  Thanks for keeping
us posted.  Future generations of people who want to use subprocess with
Spyce will thank you. :)

-Jonathan
-- 
C++ is history repeated as tragedy. Java is history repeated as farce.  --Scott McKay



-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.