H.Yamamoto
4/23/2005 11:00:00 AM
Hello.
>I have a little wrapper around TclTkIp to do tcl interpreting with a
>ruby program. It's super useful and has worked great -- until 1.8.2.
>
>Now, it appears that calling the 'exit' command in tcl with an argument
>raises an exception for some reason. You can call 'exit', just not
>'exit 0' or 'exit 1'.
>
>Has something changed that makes this the desired behavior, or is this a
>bug? The tcltk that was built against handles 'exit 0' just fine.
Bug. This is patch for CVS HEAD.
Index: tcltklib.c
===================================================================
RCS file: /src/ruby/ext/tk/tcltklib.c,v
retrieving revision 1.16
diff -u -w -b -p -r1.16 tcltklib.c
--- tcltklib.c 22 Apr 2005 08:35:40 -0000 1.16
+++ tcltklib.c 23 Apr 2005 10:40:39 -0000
@@ -2860,16 +2860,17 @@ ip_RubyExitCommand(clientData, interp, a
case 2:
#if TCL_MAJOR_VERSION >= 8
- if (!Tcl_GetIntFromObj(interp, argv[1], &state)) {
+ if (Tcl_GetIntFromObj(interp, argv[1], &state) == TCL_ERROR) {
return TCL_ERROR;
}
param = Tcl_GetString(argv[1]);
#else /* TCL_MAJOR_VERSION < 8 */
state = (int)strtol(argv[1], &endptr, 0);
- if (endptr) {
+ if (*endptr) {
Tcl_AppendResult(interp,
"expected integer but got \"",
argv[1], "\"", (char *)NULL);
+ return TCL_ERROR;
}
param = argv[1];
#endif
I'll fix this on CVS soon. Probably included in 1.8.3 preview1.