Re: Re: my ArkHost.run() woes -- fork/dup/pipe/etc bite back
Jonathan Hogg <[email protected]>
| Newsgroups | gmane.comp.sysutils.ark.devel |
|---|---|
| Message-ID | <[email protected]> |
On 11/4/01 10:33, Will Partain wrote:
>Could do, esp on the sudo case... What kinda surprised me
>was that the Popen3 stuff behaved so differently from boring
>old popen, which has given no trouble.
>
>On the ersh case, I'm wondering if it has anything to do
>with how ersh "bypasses" stdout through fd 3... Quite a lot
>of these popen-ish things seem to want to close all
>non-{0,1,2} fds.
There tends to be a bunch of deep magic in using popen3.
>One specific symptom I was seeing with "your" runCmd was
>select saying the child's stdin wanted something, then the
>os.write failing with a "pipe closed" exception.
I was playing with some code very similar to this stuff the other day (in
that case for pumping data in both directions between two sockets) and I
found that I had to wrap the writes in try...except clauses to catch IO
errors and close the pipe.
This was to deal with when the remote end decides to stop listening,
which I wouldn't have thought that sudo/ersh would do. Unless... your
scripts wouldn't have any explicit 'exit's in them would they?
I never much liked my command running code from chipmake, but it worked
for all the stuff we had to invoke. Though interestingly, they were
always either stream processing commands (like m4 and mpp) or no-input
commands (like verilog).
:-j
--
jonathan hogg, one good idea ltd, 131 queen margaret dr., glasgow g20 8pd
http://www.onegoodidea.com/ tel:+44-(0)7976-614338 fax:+44-(0)7970-537451