
One of Tcl's first "killer apps". Don Libes' (creator of Expect) book "Exploring Expect" is also one of those technical masterpieces that are very enjoyable, entertaining technical reads. Recommended if only for the discussions of terminals and interactive i/o.
[edit: typo/punctuation]
See also the Caius framework[4].
[1] http://shop.oreilly.com/product/9781565920903.do
[2] https://www.safaribooksonline.com/library/view/exploring-exp...
See also the Caius framework[4].
[1] http://shop.oreilly.com/product/9781565920903.do
[&] http://www.nist.gov/el/msid/expect.cfm
[2] https://www.safaribooksonline.com/library/view/exploring-exp...
http://www.nist.gov/el/msid/expect.cfm
Exploring Expect by Don Libes, the principal author of Expect, is a classic among tech books:
Someone in #tcl on Freenode suggested that this set of essays would be a good resource for exploring some of the new/er features in Tcl.
I'm experimenting with using Tcl as a basis for rapid prototyping and testing[4] of services and service compositions built with docker and docker-compose[5].
It would be awesome if O'Reilly would consider making Exploring Expect[1] an Open Book[3] – it's an "oldie but goodie"!
[1] http://shop.oreilly.com/product/9781565920903.do
[2] http://shop.oreilly.com/product/9780123847171.do
#43. Why doesn't Expect kill telnet (or other programs) sometimes?
From: libes (Don Libes)
To: Karl.Sierka@Labyrinth.COM
Subject: Re: need help running telnet Expect script from cron on sunos 4.1.3
karl.sierka@labyrinth.com writes:
> The only problem I am still having with the script I wrote is that
> the telnet does not seem to die on it's own, unless I turn on debugging.
Actually, Expect doesn't explicitly kill processes at all. Generally,
processes kill themselves after reading EOF on input. So it just seems
like Expect kills all of its children.
> I was forced to save the pid of the spawned telnet, and kill it with an
> 'exec kill $pid' in a proc that is hopefully called before the script
> exits. This seems to work fine, but it makes me nervous since omnet
> charges for connect time, and leaving a hung telnet lying around could
> get expensive. I warned the rest of the staff so that they will also be
> on the lookout for any possible hung telnets to omnet.
The problem is that telnet is not recognizing EOF. (This is quite
understandable since real users can't actually generate one from the
telnet user interface.) The solution is to either 1) explicitly drive
telnet to kill itself (i.e., a graceful logout) followed by "expect
eof" or 2) "exec kill" as you are doing.
This is described further in Exploring Expect beginning on page 103.
Don