In article <
[email protected]>, heinrichmartin <
[email protected]> wrote:
Thanks for your response. I think, though, that most of your questions
have already been anticipated, and I give responses below.
I guess you want to use "Inside a SIGCHLD handler, it is possible to wait
for any spawned process by using the spawn id -1." to be more robust in >complex scenarios.
Not really relevant to the thread, but interesting. Actually, a better
overall solution is just to have the handler do: incr cflag
and let the regular inline code take things from there. I.e., do the wait inline (after returning from the "interact") instead of in the handler.
Have you tried to debug whether pattern eof is detected? You could define a >non-default eof pattern or investigate exp_internal.
I haven't actually tried it, but I had read about "eof". From what I can
tell, it wouldn't help, because "eof" is caught by default anyway, so if
"eof" were being triggered, I'd already have a solution to the problem.
I'm not familiar with exp_internal. What is that?
puts "Bye bye!"
--- Cut Here ---
When I run the above script, I interact with "nl" for a bit, then press ^D >> to cause "nl" to exit.
Your problem is _not_ that the child process does not exit, is it?
No. I can tell tha the child process has exited (and gone zombie,
unless/until I do a "wait").
Anyway, reviewing stty settings could help.
Don't think that is relevant.
Have you tried close inside the handler?
Well, as I indicated in the OP, doing a close would defeat the overall
purpose. As I said, doing "close -slave" does make things work "normally",
but again, defeats the purpose.
Just to clarify, the overall purpose is this: I want to run multiple
processes in a loop. Normally, the model is:
1) spawn myProcess
2) interact
(interact runs, and returns when the process exits)
3) wait (to de-zombie)
4) goto 1
I want to change the model to:
1) spawn -pty
2) exec my program, connecting it to the tty (details in original code)
3) interact
(interact runs, but, unfortunately, does not return when the process exits)
(but, using the CHLD hack, we can "fake" that result)
4) wait (to de-zombie)
5) goto 2
The point being that I want to spawn the pty once, and keep it open
thereafter. The reasons for *why* I want to do this are beyond the scope
of this article.
--
The randomly chosen signature file that would have appeared here is more than 4 lines long. As such, it violates one or more Usenet RFCs. In order to remain in compliance with said RFCs, the actual sig can be found at the following URL:
http://user.xmission.com/~gazelle/Sigs/God
--- SoupGate-Win32 v1.05
* Origin: fsxNet Usenet Gateway (21:1/5)