Tk Source Code

Artifact [d673a75c]
Login

Artifact d673a75c182e839b28f0ba0fbe9aa0bd09cf46e1:

Attachment "console-1487701.diff" to ticket [1487701f] added by hobbs 2006-11-24 03:30:25.
Index: macosx/tkMacOSXInit.c
===================================================================
RCS file: /cvsroot/tktoolkit/tk/macosx/tkMacOSXInit.c,v
retrieving revision 1.24
diff -u -r1.24 tkMacOSXInit.c
--- macosx/tkMacOSXInit.c	16 Oct 2006 15:35:28 -0000	1.24
+++ macosx/tkMacOSXInit.c	23 Nov 2006 20:29:19 -0000
@@ -246,9 +246,17 @@
 		Tcl_RegisterChannel(interp, Tcl_GetStdChannel(TCL_STDIN));
 		Tcl_RegisterChannel(interp, Tcl_GetStdChannel(TCL_STDOUT));
 		Tcl_RegisterChannel(interp, Tcl_GetStdChannel(TCL_STDERR));
-		/* Only show the console if we don't have a startup script */
+		/*
+		 * Only show the console if we don't have a startup script
+		 * and tcl_interactive hasn't been set already.
+		 */
 		if (Tcl_GetStartupScript(NULL) == NULL) {
-		    Tcl_SetVar(interp, "tcl_interactive", "1", TCL_GLOBAL_ONLY);
+		    CONST char *intvar =
+			Tcl_GetVar(interp, "tcl_interactive", TCL_GLOBAL_ONLY);
+		    if (intvar == NULL) {
+			Tcl_SetVar(interp, "tcl_interactive", "1",
+				TCL_GLOBAL_ONLY);
+		    }
 		}
 		if (Tk_CreateConsoleWindow(interp) == TCL_ERROR) {
 		    return TCL_ERROR;