summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2005-07-27 16:23:03 (GMT)
committerdgp <dgp@users.sourceforge.net>2005-07-27 16:23:03 (GMT)
commit2430f497f1715d87f7c9b5f9374320566776fb6f (patch)
tree1d9c6aba23a9f5493ef1e6f2dc7b76b58b951f3c
parent99a3268ecf555ad04f3ce935d0c29b2477762c74 (diff)
downloadtcl-2430f497f1715d87f7c9b5f9374320566776fb6f.zip
tcl-2430f497f1715d87f7c9b5f9374320566776fb6f.tar.gz
tcl-2430f497f1715d87f7c9b5f9374320566776fb6f.tar.bz2
* library/init.tcl ([unknown]): Corrected return code handling
in the portions of [unknown] that expand incomplete commands during interactive operations. [Bug 1214462].
-rw-r--r--ChangeLog6
-rw-r--r--library/init.tcl18
2 files changed, 20 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index 8d96f02..c5633dd 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2005-07-27 Don Porter <dgp@users.sourceforge.net>
+
+ * library/init.tcl ([unknown]): Corrected return code handling
+ in the portions of [unknown] that expand incomplete commands
+ during interactive operations. [Bug 1214462].
+
2005-07-26 Mo DeJong <mdejong@users.sourceforge.net>
* unix/configure: Regen.
diff --git a/library/init.tcl b/library/init.tcl
index e1f4b05..626f9f3 100644
--- a/library/init.tcl
+++ b/library/init.tcl
@@ -3,7 +3,7 @@
# Default system startup file for Tcl-based applications. Defines
# "unknown" procedure and auto-load facilities.
#
-# RCS: @(#) $Id: init.tcl,v 1.78 2005/07/23 04:12:49 dgp Exp $
+# RCS: @(#) $Id: init.tcl,v 1.79 2005/07/27 16:24:14 dgp Exp $
#
# Copyright (c) 1991-1993 The Regents of the University of California.
# Copyright (c) 1994-1996 Sun Microsystems, Inc.
@@ -328,7 +328,11 @@ proc unknown args {
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 @@ proc unknown args {
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 @@ proc unknown args {
}
}
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]"