Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

#5 expect on multiple children at once (select)

closed
nobody
None
5
2014-06-03
2006-09-28
gutef
No

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) )

if (!result):
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.

Thanks!

Discussion

  • Thomas Kluyver
    Thomas Kluyver
    2014-06-03

    • status: open --> closed
    • Group: --> Next Release (example)
     
  • Thomas Kluyver
    Thomas Kluyver
    2014-06-03

    This is now being tracked as issue 50 on Github, so I'm closing this copy.