expect - How to set up pexpect expecting multiple outcomes -


we have scenario have 2 expect outcomes execute with. below, after sending status command, give outcome of 2 possible outcomes. 'run' or 'not run'

eg

t.sendline('status') i=t.expect('run') if i!=0:     t.sendline('start') else:     break 

when ran our script, keeps getting stuck @ i=t.expect('run') line , fails when status returns 'not run'

how set such 1. doesnt stop script exiting when executing i=t.expect('run') , continues run. 2. can use 2 expect outcomes in our script execute outcome.

thanks sincerely

t.sendline('status') i=t.expect(['run','not run']) if(i==0):     t.sendline('start') else:     break; 

source http://www.noah.org/wiki/pexpect


Comments

Popular posts from this blog

php - Calling a template part from a post -

Firefox SVG shape not printing when it has stroke -

How to mention the localhost in android -