There is a feature of TCL-expect that I really miss on
pexpect: being able to wait on a number of spawn
children within a single command. I guess my way of
better describing it would be by example:
child1 = pexpect.spawn ('ftp site1.org')
child2 = pexpect.spawn ('ftp site2.org')
child3 = pexpect.spawn ('ftp site3.org')
strExpect = 'Name .*: '
result, childMatch = expectSelect( (child1, strExpect), \ (child2, strExpect), \ (child3, strExpect) )
print "timed out on all children"
if (childMatch == 1):
print "matched on child 1"
The main idea of this feature request is that we obtain
a _select_ behavior such that a single execution thread
can continue as soon as the first match (or timeout)
takes place in any of the children in a list provided.
TCL expect allows for that by providing a list of
spawned ids in the -i flag. This is extremely useful
for performance reasons when dealing with multiple
children that are spawned cincurrently.
Log in to post a comment.