expect: when does a spawned process terminate?

mlnpscda used Ask the Experts™
when an expect script spawns a process, say, telnet

spawn telnet $target

the script does its thing then exits.  Is the telnet session still hanging around? Or does it close when the script terminates?

Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Julian ParkerSenior Systems Administrator

I tend to find the session terminates when the session is closed.
Software Developer
telnet will close when the script finishes (because it gets end of file on its stdin).
In general the easiest way to terminate a spawned process is to exit the expect script; otherwise you have to "expect eof" "wait" and so on

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial