But you've wrapped that code in a proc.
As i wrote earlier:
If the script i use in a catch:
** a. is not wrapped in "proc" ; and,
b. ends with "return"
Then:
catch considers this an error (i.e. not TCL_OK).
The point being, code like:
proc runit { script } {
if...
That's how i thought it would work, too, but it doesn't (as i noted in the original post):
% catch { return -code 0 }
2
% catch { return -code ok }
2
That's in Tcl 8.3 (Windows) and 8.4 (Linux). 'catch' directly receives the return code from 'return' (TCL_RETURN == 2) which is considered an...
If the script i use in a catch:
a. is not wrapped in "proc"; and,
b. ends with "return"
Then:
catch considers this an error (i.e. not TCL_OK).
This feature is documented in the Tcl/Tk man pages and in Welch.
As an example of the behavior, consider:
% proc bar { } { return }
% catch {...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.