nodejitsu / nexpect

spawn and control child processes in node.js with ease
http://github.com/nodejitsu/nexpect
Other
290 stars 37 forks source link

Difference between expect() and wait()? #10

Closed cxyokk closed 10 years ago

cxyokk commented 10 years ago

ATT

cxyokk commented 10 years ago

oh, i see the difference...

This will work:

nexpect = require('nexpect')
nexpect.spawn('seq 10')
  .expect('1') # matched '1'
  .wait('3') # skipped '2' and matched '3'
  .run (err)->
    console.log err

This won't work:

nexpect = require('nexpect')
nexpect.spawn('seq 10')
  .expect('1') # matched '1'
  .expect('3') # compared with '2' and failed
  .run (err)->
    console.log err