From 52862d4aeb45df2aad6c9d0b2ef00fcb89790be8 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Fri, 19 Feb 2016 10:49:57 +0000 Subject: Proposed fix for [9b47029467631832]: testing existence of env(some_thing) destroys traces. Was the comment [http://core.tcl.tk/tcl/artifact/f93c0675115b73ce?ln=554|here] not correct after all?. --- generic/tclEnv.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/generic/tclEnv.c b/generic/tclEnv.c index 2cb240d..66ddb57 100644 --- a/generic/tclEnv.c +++ b/generic/tclEnv.c @@ -551,7 +551,8 @@ TclGetEnv( * array. * * Results: - * Always returns NULL to indicate success. + * Returns NULL to indicate success, or an error-message if the array + * element being handled doesn't exist. * * Side effects: * Environment variable changes get propagated. If the whole "env" array @@ -609,8 +610,7 @@ EnvTraceProc( const char *value = TclGetEnv(name2, &valueString); if (value == NULL) { - Tcl_UnsetVar2(interp, name1, name2, 0); - return NULL; + return (char *) "no such variable"; } Tcl_SetVar2(interp, name1, name2, value, 0); Tcl_DStringFree(&valueString); -- cgit v0.12