From 2430f497f1715d87f7c9b5f9374320566776fb6f Mon Sep 17 00:00:00 2001 From: dgp Date: Wed, 27 Jul 2005 16:23:03 +0000 Subject: * library/init.tcl ([unknown]): Corrected return code handling in the portions of [unknown] that expand incomplete commands during interactive operations. [Bug 1214462]. --- ChangeLog | 6 ++++++ library/init.tcl | 18 ++++++++++++++---- 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 + + * 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 * 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]" -- cgit v0.12