proc main {} {
# ... put the real main code in here ...
}
if {[catch {main} msg options]} {
puts stderr "unexpected script error: $msg"
if {[info exists env(DEBUG)]} {
puts stderr "---- BEGIN TRACE ----"
puts stderr [dict get $options -errorinfo]
puts stderr "---- END TRACE ----"
}
# Reserve code 1 for "expected" error exits...
exit 2
} Copyright © 1993 The Regents of the University of California.
Copyright © 1994-1996 Sun Microsystems, Inc.
Licensed under Tcl/Tk terms
https://www.tcl.tk/man/tcl/TclCmd/exit.htm