Re: return value from an expect script
Available news archives: comp.lang.tcl - comp.lang.python - comp.security.firewalls - sci.crypt - comp.lang.php - comp.lang.javascript
Google
 
Web news.hping.org


comp.lang.tcl archive

Re: return value from an expect script

From: Michael A. Cleverly <michael@cleverly.com>
Date: Sat Jul 30 2005 - 03:06:46 CEST

On Fri, 29 Jul 2005 carson_wilcox@yahoo.com wrote:

> I am having a problem with the return value from an expect script.
> I call the expect script from an executable and it is used to login to
> an rf gun in a warehouse. Once the login is accomplished, I go to
> interact mode so the gun is talking directly to the calling process.
> My problem is that when something goes wrong with the gun and it's
> process is no longer usefull it either goes to init or dies and one or
> both of the calling process goes to runaway.
> It appears that when the gun process dies the expect process always
> returns successful to the calling curses process even tho there is no
> longer a display attached causing the runnaway.
> Does anyone have any thoughts on this.

When the spawn'ed process dies interact will return. If you want the
script to exit at that point follow it with an exit. I.e.,

spawn /your/program
# do your login
interact
exit 1 ;# or some other suitable exit status

... or something simillar. Then have your executable that calls the
Expect script test the exit status to see if it should exit (or have it
exit too).

Michael
Received on Thu Sep 29 14:28:02 2005