Restrictions On Spawning Multiple Processes

There is no explicit restriction on spawning multiple processes—any number of processes may be running under control of Expect. However, some old—perhaps archaic is a better word—systems do not provide a facility for listening from multiple processes simultaneously. When Expect is installed, it looks for the presence of the select or poll system call. Either of these usually indicates that Expect can listen to multiple processes simultaneously.

Some systems provide select or poll but do not allow them to be used the way Expect needs. In this case, Expect simulates this functionality using the read system call with alarms. When using read, Expect has one major restriction. Only one process can be listened to (with either expect or interact) at a time.

Fortunately, such systems are rare and growing rarer.[52] Although you cannot run Expect with all of its power on them, you can still get useful work done even by automating one application at a time.

[52] Expect detects and reports at installation time if your system cannot spawn multiple processes simultaneously.

Get Exploring Expect now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.