Another Expect jewel, somewhere between spawn and interact. http://www.cotse.com/dlf/man/expect/overlay.htm outlines its functionality.
Also see http://expect.nist.gov/FAQ.html#q16
avalon: I tried "overlay -0 $spawn_id -1 $spawn_id -2 $spawn_id tee" with the hope expect will exit and leave tee serve like a pipe optionally logging to file as well. But I get "tee: read error: Resource temporarily unavailable". Any ideas what's wrong?