![]() |
|
Clear questions and runnable code get the best and fastest answer |
|
PerlMonks |
How to handle Expect::Simple sessions to programs that end normally.by DrWhy (Chaplain) |
on Apr 21, 2010 at 00:18 UTC ( [id://835917]=perlquestion: print w/replies, xml ) | Need Help?? |
DrWhy has asked for the wisdom of the Perl Monks concerning the following question:
After several years of being interested in the capabilities of Expect I finally have an occasion to use it (and learn how it works). I'm using Expect::Simple to write test code for a shell-script-based installer that asks the user several questions before installation happens. I've got it working okay in a test environment, but when the install script finishes its work it exits (as it should) causing the Expect::Simple object to get very confused. I can't figure out how with Expect::Simple to catch this normal exit and respond appropriately. As it stands now, when the installer exits, my Expect::Simple script dies with the error:
Expect::Simple: couldn't find prompt after sendIf I catch this die and look at the $simplexpect->expect_error() value, it looks something like this: 3:Child PID 8093 exited with status 0Now, I could catch the die and parse the expect_error() message to look for a type 3 error with /status 0$/ in it, but surely there is a 'Simple'r way to catch the successful conclusion of the command that is being controlled by Expect::Simple. Does anyone know of a better way to do this? Thanks, --DrWhy "If God had meant for us to think for ourselves he would have given us brains. Oh, wait..."
Back to
Seekers of Perl Wisdom
|
|