Subject: Re: [PATCH] print errors to stderr
From: Oliver Kiddle <[email-masked]>
To: [email-masked]
Date: Thu, 23 Jun 2016 12:04:45 +0200
List-Id: Zsh Workers List <zsh-workers.zsh.org>

Bart wrote:
> } I think this behaviour is actually intentional. It is arguably not an
> } error - the whence command's purpose is to search for something and
> } report on whether it is found. So it doesn't rely on finding it. Also,
> } this is compatible with csh and tcsh - the which command was a csh thing
> } first.
>
> Maybe it's time for either the doc or a code comment to explain this,

Sounds sensible.

Oliver

diff --git a/Src/builtin.c b/Src/builtin.c
index c2fb81e..bfb9e69 100644
--- a/Src/builtin.c
+++ b/Src/builtin.c
@@ -3633,6 +3633,7 @@ bin_whence(char *nam, char **argv, Options ops, int func)
 		}
 	    }
 	    if (!informed && (wd || v || csh)) {
+		/* this is information and not an error so, as in csh, use stdout */
 		zputs(*argv, stdout);
 		puts(wd ? ": none" : " not found");
 		returnval = 1;
@@ -3652,7 +3653,7 @@ bin_whence(char *nam, char **argv, Options ops, int func)
 	    }
 	    informed = 1;
 	} else {
-	    /* Not found at all. */
+	    /* Not found at all. That's not an error as such so this goes to stdout */
 	    if (v || csh || wd)
 		zputs(*argv, stdout), puts(wd ? ": none" : " not found");
 	    returnval = 1;