nodejitsu/nexpect — pull request #19 by gcochard (2014-06-17 16:42:48+00:00)
Title: Updating nexpect to emit events.

This allows nexpect to work with conditional branching. It will emit 'wait' right now, and the data will be the line of output which matches the expected output. From there, you can re-test the data and call sendline, expect, or wait again. Note that the user MUST call wait BEFORE the end of the stackframe on which the child was spawned.

This is a rough first draft, but it does not introduce any breaking changes as far as I can tell. All tests still pass, and the new test I have written demonstrates the new functionality. I have also added an example to the readme file.

I think this feature is critical to getting nexpect to actually act like tcl's expect. Otherwise, there is no way that I see to send different input based on the output.