[qmtest] [PATCH] Reliably close stdin in 'qm.executable.Filter'
Mark Mitchell
mark at codesourcery.com
Fri Aug 15 00:24:16 UTC 2003
On Thu, 2003-08-14 at 16:38, Nathaniel Smith wrote:
> This patch modifies 'TimeoutExecutable' so that the monitor process it
> creates closes all fds; this fixes a bug where children spawned by
> 'Filter' would not see their stdin closed at the appropriate time.
> Also adds a new test for this.
Cool.
+ # Close all fds. This is especially important to avoid
+ # keeping any pipes to the child process open after our
+ # parent has closed them.
Let's be a little more specific. How about:
Close all open file descriptors. They are not needed in the monitor
process. Furthermore, when the parent closes the write end of the stdin
pipe to the child, we do not want the pipe to remain open; leaving the
pipe open might cause the child to block waiting for additional input.
?
+ for fd in range(max_fds):
Should that use xrange? I'm never quite sure when one is a win over the
other. I'll trust your judgement.
Thanks!
--
Mark Mitchell <mark at codesourcery.com>
CodeSourcery, LLC
More information about the qmtest
mailing list