Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Can you "catch" a spawn error?

908 views
Skip to first unread message

Rob Sciuk

unread,
Mar 16, 2012, 3:59:54 PM3/16/12
to

Using expect, I'm wondering if the following is doing what I'm expecting??


#
# telnet to xyzzy ...
if { ![catch {spawn -noecho telnet xyzzy;} err ] } {
puts [format " -- Error: unable to spawn telnet session: %d" $err ]
exit 1
}

Gerald W. Lester

unread,
Mar 17, 2012, 9:44:42 AM3/17/12
to
Yes it does.

You can catch any error except for some very bad ones -- like "out of
memory" or "could not allocate memory", etc ...

--
+------------------------------------------------------------------------+
| Gerald W. Lester, President, KNG Consulting LLC |
| Email: Gerald...@kng-consulting.net |
+------------------------------------------------------------------------+

Rob Sciuk

unread,
Mar 17, 2012, 11:53:58 AM3/17/12
to
On Sat, 17 Mar 2012, Gerald W. Lester wrote:

> Date: Sat, 17 Mar 2012 08:44:42 -0500
> From: Gerald W. Lester <Gerald...@KnG-Consulting.net>
> Newsgroups: comp.lang.tcl
> Subject: Re: Can you "catch" a spawn error?
>
> On 3/16/12 2:59 PM, Rob Sciuk wrote:
>>
>> Using expect, I'm wondering if the following is doing what I'm expecting??
>>
>>
>> #
>> # telnet to xyzzy ...
>> if { ![catch {spawn -noecho telnet xyzzy;} err ] } {
>> puts [format " -- Error: unable to spawn telnet session: %d" $err ]
>> exit 1
>> }
>
> Yes it does.
>
> You can catch any error except for some very bad ones -- like "out of memory"
> or "could not allocate memory", etc ...
>

Thanks Gerald. I've found my problem ...

Cheers,
Rob.
0 new messages