Tcl Source Code

Artifact [bfe110f11d]
Login

Artifact bfe110f11d96a469c1d654a0104ed1f0451cfcbd:

Attachment "1214462.patch" to ticket [1214462fff] added by dgp 2005-07-27 23:23:14.
Index: library/init.tcl
===================================================================
RCS file: /cvsroot/tcl/tcl/library/init.tcl,v
retrieving revision 1.78
diff -u -r1.78 init.tcl
--- library/init.tcl	23 Jul 2005 04:12:49 -0000	1.78
+++ library/init.tcl	27 Jul 2005 16:15:49 -0000
@@ -328,7 +328,11 @@
 		if {[namespace which -command console] eq ""} {
 		    set redir ">&@stdout <@stdin"
 		}
-		return [uplevel 1 exec $redir $new [lrange $args 1 end]]
+		uplevel 1 [list ::catch \
+			[concat exec $redir $new [lrange $args 1 end]] \
+			::tcl::UnknownResult ::tcl::UnknownOptions]
+		dict incr ::tcl::UnknownOptions -level
+		return -options $::tcl::UnknownOptions $::tcl::UnknownResult
 	    }
 	}
 	if {$name eq "!!"} {
@@ -342,7 +346,10 @@
 	if {[info exists newcmd]} {
 	    tclLog $newcmd
 	    history change $newcmd 0
-	    return [uplevel 1 $newcmd]
+	    uplevel 1 [list ::catch $newcmd \
+		    ::tcl::UnknownResult ::tcl::UnknownOptions]
+	    dict incr ::tcl::UnknownOptions -level
+	    return -options $::tcl::UnknownOptions $::tcl::UnknownResult
 	}
 
 	set ret [catch {set candidates [info commands $name*]} msg]
@@ -371,7 +378,10 @@
 	    }
 	}
 	if {[llength $cmds] == 1} {
-	    return [uplevel 1 [lreplace $args 0 0 [lindex $cmds 0]]]
+	    uplevel 1 [list ::catch [lreplace $args 0 0 [lindex $cmds 0]] \
+		    ::tcl::UnknownResult ::tcl::UnknownOptions]
+	    dict incr ::tcl::UnknownOptions -level
+	    return -options $::tcl::UnknownOptions $::tcl::UnknownResult
 	}
 	if {[llength $cmds]} {
 	    return -code error "ambiguous command name \"$name\": [lsort $cmds]"