The SessionCleanup() function contains a statement
catch [expect *];
which paradoxically throws an exception (the TCL term
seems to be "TCL error"), and thus aborts the
SessionCleanup() function, whenever you try to close a
session that has been opened successfully. It would
seem that this defeats the purpose of having a catch
statement in the code in the first place.
Both
catch {[expect *]};
and
catch {expect *};
seem to properly catch any exceptions that may be
thrown by the "expect *" statement. (I do not know
TCL well enough to tell which combination of braces
and/or rectangular brackets is the "correct" one, or
why "catch" would fail to catch an exception when there
are no braces at all. In any event, both versions seem
to have the same effect.)
The problem with "::libcisco::session close" consistently
aborting each and every time occurred on a Sun Ultra-
5_10 machine running SunOS 5.8 (a.k.a. Solaris 8),
patch level Generic_108528-23, equipped with TCL 8.4
and expect 5.38. If it matters, the telnet
implementation reports "Connection closed by foreign
host" when you disconnect, while libcisco seems to be
waiting for "session disconnected" instead.
libkernel.tcl