From: Austin S. <te...@of...> - 2002-08-29 19:41:33
|
On Thu, Aug 29, 2002 at 10:35:30AM +0200, Roland Giersig wrote: > > It's been a while since I tracked it down, but I seem to remember > > that it ran into trouble in IO::Pty::make_slave_controlling_terminal. > > IO-Tty and Expect now correctly handle the controlling terminal of the > spawned process, that is, the spawned process runs in its own process > group and gets the slave pty set as its controlling terminal (otherwise > Expect wouldn't be able to handle password prompts). The spawned process needs its own session id, via setsid(). That sets the process to expect control chars from the newly created terminal. Process group affects how signals are processed - when a process is killed all the children in the process group are HUPped. Typically these are the same, but not so for expect. With expect you want the spawned process to have its own session id so it can get signals from the parent, but you want to leave the process group alone so when the parent process dies it takes the spawned children with it. Presumably if you didn't like the behavior you could run setpgrp() from the child, thus letting it remain when the parent dies. Well, as long as you didn't try to read from /dev/tty or STDIN after that. At least that's how it seemed to be working when I was monkeying with it. :-) Austin |