summaryrefslogtreecommitdiffstats
path: root/doc/exec.n
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2004-11-20 00:17:28 (GMT)
committerdgp <dgp@users.sourceforge.net>2004-11-20 00:17:28 (GMT)
commitff53303dbf5fc75eea7bb3d9bc569267adb1d49b (patch)
tree37544eb5529a0eb1f2f1a0f46ad94a43354cc96b /doc/exec.n
parent2c96347f634403dffaf0ecf177118cd8202af841 (diff)
downloadtcl-ff53303dbf5fc75eea7bb3d9bc569267adb1d49b.zip
tcl-ff53303dbf5fc75eea7bb3d9bc569267adb1d49b.tar.gz
tcl-ff53303dbf5fc75eea7bb3d9bc569267adb1d49b.tar.bz2
* doc/AddErrInfo.3: Docs for Tcl_(Get|Set)ReturnOptions. [TIP 227]
* doc/AddErrInfo.3: * doc/Async.3: Documentation updates to replace references * doc/BackgdErr.3: to global variable ::errorInfo and ::errorCode * doc/SaveResult.3: and to the ::bgerror command with references * doc/after.n: to their preferred replacements, the * doc/bgerror.n: -errorinfo and -errorcode return options, * doc/error.n: the Tcl_*InterpState routines, and the * doc/exec.n: [interp bgerror] command. * doc/exit.n: * doc/fileevent.n: * doc/interp.n: * doc/return.n: * doc/tclvars.n: * doc/update.n:
Diffstat (limited to 'doc/exec.n')
-rw-r--r--doc/exec.n15
1 files changed, 8 insertions, 7 deletions
diff --git a/doc/exec.n b/doc/exec.n
index 43893d8..2e094fa 100644
--- a/doc/exec.n
+++ b/doc/exec.n
@@ -5,7 +5,7 @@
'\" See the file "license.terms" for information on usage and redistribution
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
'\"
-'\" RCS: @(#) $Id: exec.n,v 1.12 2004/10/27 09:36:58 dkf Exp $
+'\" RCS: @(#) $Id: exec.n,v 1.13 2004/11/20 00:17:32 dgp Exp $
'\"
.so man.macros
.TH exec n 8.5 Tcl "Tcl Built-In Commands"
@@ -134,7 +134,7 @@ If any of the commands in the pipeline exit abnormally or
are killed or suspended, then \fBexec\fR will return an error
and the error message will include the pipeline's output followed by
error messages describing the abnormal terminations; the
-\fBerrorCode\fR variable will contain additional information
+\fB-errorcode\fR return option will contain additional information
about the last abnormal termination encountered.
If any of the commands writes to its standard error file and that
standard error isn't redirected,
@@ -337,13 +337,14 @@ To execute a simple program and get its result:
.CE
.PP
To execute a program that can return a non-zero result, you should
-wrap the call to \fBexec\fR in \fBcatch\fR and check what the contents
-of the global \fBerrorCode\fR variable is if you have an error:
+wrap the call to \fBexec\fR in \fBcatch\fR and check the contents
+of the \fB-errorcode\fR return option if you have an error:
.CS
set status 0
-if {[catch {\fBexec\fR grep foo bar.txt} results]} {
- if {[lindex $::errorCode 0] eq "CHILDSTATUS"} {
- set status [lindex $::errorCode 2]
+if {[catch {\fBexec\fR grep foo bar.txt} results options]} {
+ set details [dict get $options -errorcode]
+ if {[lindex $details 0] eq "CHILDSTATUS"} {
+ set status [lindex $details 2]
} else {
# Some kind of unexpected failure
}