Skip to Content
Exploring Expect
book

Exploring Expect

by Don Libes
December 1994
Intermediate to advanced
606 pages
16h 7m
English
O'Reilly Media, Inc.
Content preview from Exploring Expect

The expect Command And The Tk Event Loop

When waiting inside of expect (or interact) commands, the Tk event loop is still active. This means that the user can, for example, press buttons on the screen and Tk will respond to the buttons while the script is executing an expect command.

While any specific action is being executed from the Tk event loop, the original expect command cannot return. If the user presses a button that kicks off, say, another expect command, the original expect command cannot return until the new expect command returns. (This is true for any command in Tk, not just expect commands.)

If both expect commands read from the same spawn id, the later one will see all the buffered data already received. The new expect command can match data that the original expect command had read but not matched.

All of the descriptions so far are identical to the way Expect works without Tk but in the presence of signals. expect commands that are triggered by signal handlers suspend any currently active expect commands.

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

AI Agents in Action

AI Agents in Action

Micheal Lanham
Learning Go

Learning Go

Jon Bodner

Publisher Resources

ISBN: 9781565920903Supplemental ContentErrata Page