summaryrefslogtreecommitdiffstats
path: root/generic/tclMain.c
diff options
context:
space:
mode:
Diffstat (limited to 'generic/tclMain.c')
-rw-r--r--generic/tclMain.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/generic/tclMain.c b/generic/tclMain.c
index 238b485..7869cec 100644
--- a/generic/tclMain.c
+++ b/generic/tclMain.c
@@ -10,7 +10,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclMain.c,v 1.28 2004/10/15 04:01:32 dgp Exp $
+ * RCS: @(#) $Id: tclMain.c,v 1.29 2004/10/25 17:24:39 dgp Exp $
*/
#include "tclInt.h"
@@ -435,17 +435,19 @@ Tcl_Main(argc, argv, appInitProc)
if (code != TCL_OK) {
errChannel = Tcl_GetStdChannel(TCL_STDERR);
if (errChannel) {
+ Tcl_Obj *options = TclGetReturnOptions(interp, code);
+ Tcl_Obj *keyPtr = Tcl_NewStringObj("-errorinfo", -1);
+ Tcl_Obj *valuePtr;
- /*
- * The following statement guarantees that the errorInfo
- * variable is set properly when the error has to do with
- * the opening or reading of the file.
- */
+ Tcl_IncrRefCount(keyPtr);
+ Tcl_DictObjGet(NULL, options, keyPtr, &valuePtr);
+ Tcl_DecrRefCount(keyPtr);
- Tcl_AddErrorInfo(interp, "");
- Tcl_WriteObj(errChannel, Tcl_GetVar2Ex(interp, "errorInfo",
- NULL, TCL_GLOBAL_ONLY));
+ if (valuePtr) {
+ Tcl_WriteObj(errChannel, valuePtr);
+ }
Tcl_WriteChars(errChannel, "\n", 1);
+ Tcl_DecrRefCount(options);
}
exitCode = 1;
}