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

Differences Between Expect And The Expect Extension In Another Program

When using tclsh or any other program to which you have added Exp_Init, you may encounter differences between it and Expect.

  • Command-Line Argument Handling

    Expect defines the behavior of the command-line flags such as -c and -d. Any other program is not likely to support these. tclsh supports only the -f flag. Most Tcl programs make other arguments available to the script using the argv and argc variables as Expect does.

  • Signal Handling

    It is possible for other extensions to try and handle signals at the same time that Expect does. However, only one extension can handle the same signal at a time. Multiple extensions may claim to be handling the signal but only one of the signal handlers will be called. Signal definitions should be under control of the user so this should not be a problem.

    The default signal handlers that Expect uses (i.e., SIGINT, SIGTERM) are not automatically established by tclsh.

  • Command Names

    Expect commands that share the same names as commands in another extension are usually suppressed (unless the other extension also suppresses its own definition). For example, if another extension defines "spawn“, it overrides Expect’s spawn.

    To guarantee that you get Expect’s commands, preface them with "exp_“. For example, when using Tk, "send" is Tk’s while "exp_send" is Expect’s. The "exp_" versions are always available, even when not using any other extensions, so you can use them all the time if you do ...

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