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

Background Actions

When a background pattern matches, the associated action is evaluated. Evaluation of the action follows the same rules as for a regular expect command. However, inside the action, background patterns for the same spawn id are blocked from further matching. This prevents input that arrived later (i.e., in the middle of an action) from being processed while input associated with the pending action is still being processed.

Any command may be used in the action of a background pattern including another expect or expect_background. expect_background commands allow background patterns from a different spawn id to begin matching immediately—even before the current action finishes. expect commands are executed as usual (i.e., immediately), even if they are for the same spawn id as the one associated with the currently executing background action.

It is not possible to wait using both expect and expect_background for output from the same spawn id at precisely the same time. The behavior in such a situation is undefined.

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