Expect spawn error handling 
Author Message
 Expect spawn error handling

Hello.

I am writing a n expect script that calls tip(). The lines in question
look like this: (mostly out of the "Exploring Expect" book.)

        # Connect to a modem via tip()
        if [catch "spawn tip $dialer" reason] {
           send_user "Tip failed: $reason\n"
           exit 1
        }

This works well if there is success or a exec problem, but sometimes the
modem is in use by another process and tip dies right away with the error

   lock open: Permission denied
   all ports busy

(this is from running tip at the csh command prompt)

When the expect script runs into this, expect dies with the message:

    spawn tip test_line1
    lock open: Permission denied
    all ports busy
    send: invalid spawn id (5)
    while executing
    "send "AT\r""
    (procedure "connect" line 5)
[...]

How can I collect the 2 tip() error messages ("lock open: Permission denied"
and "all ports busy"), parse them and do the appropriate thing? ...like
sleep 5 minutes and try again 3 or 4 time before giving up with an
appropriate message?

I have yet to find anything that works.

--
Thanks in advance for any and all help,
Steve Freed.



Tue, 30 Dec 1997 03:00:00 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. handling errors from spawn'ed commands in Expect

2. how to handle expect: spawn ssh two different things

3. expect_after executes for spawn id 1 even if the corresponding expect executes for spawn id 2

4. expect: nesting spawn tftp inside spawned telnet

5. using spawn socket instead of spawn telnet in expect

6. Error using Expect and spawn with scp

7. expect: spawn id exp7 not open error.

8. expect: spawn a process and redirect the standard error to a variable

9. Expect - spawn sync byte errors

10. Please HELP: spawn telnet error in Expect

11. Help with Expect error - invalid spawn id

12. Expect: spawn dies with usage error

 

 
Powered by phpBB® Forum Software