From: Austin S. <te...@of...> - 2003-08-27 08:08:38
|
On Wed, Aug 27, 2003 at 09:22:45AM +0200, Roland Giersig wrote: > >>I have patched my problem by commenting out the > >> > >> $exp->hard_close(); > >> > >>on line 853 of Expect.pm - which I realize is a drastic step. > >> > >>What am I doing wrong? Why would expect decide to close my filehandle? > >>What can I do about it so that I do not have to modify the Expect.pm > >>program. > > this works as intended, the other side (spwaned program) has closed its > stdout, which normally is an indication that the program exits. if you > need a more fine-grained control over the input and output streams, take > a look at IPC::Run. Yes, this is true, _normally_, and maybe it would be worthwhile to try a non-blocking waitpid, or even block a couple seconds and do that. hard_close() will explicitly _kill_ the process, however. That doesn't seem like intuitive behavior during an expect() call, imo. soft_close might be a good choice, except that it also will kill the process if it doesn't go away after the handle is closed. What it should do (and should have done, my fault) is merely close the handle and wait for a bit, returning an error if the process doesn't go away by itself. Again that's all just imo. Austin |