From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10463 invoked from network); 24 Jun 2001 04:09:42 -0000 Received: from sunsite.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 24 Jun 2001 04:09:42 -0000 Received: (qmail 855 invoked by alias); 24 Jun 2001 04:08:58 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 15057 Received: (qmail 823 invoked from network); 24 Jun 2001 04:08:57 -0000 From: "Bart Schaefer" Message-Id: <1010624040635.ZM9031@candle.brasslantern.com> Date: Sun, 24 Jun 2001 04:06:35 +0000 In-Reply-To: Comments: In reply to Peter Stephenson "Is PRINT_EXIT_VALUE supposed to work?" (Jun 15, 2:22pm) References: X-Mailer: Z-Mail (5.0.0 30July97) To: zsh-workers@sunsite.dk (Zsh hackers list) Subject: PATCH: Re: Is PRINT_EXIT_VALUE supposed to work? MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii On Jun 15, 2:22pm, Peter Stephenson wrote: } Subject: Is PRINT_EXIT_VALUE supposed to work? } } I've never looked at this option until now, when I'm trying to write a } test for it. It doesn't work with functions. The simplest thing seems to be the patch below. I don't see any reason to print the exit value of a builtin before flushing the stdout of that builtin (though I also don't know of any case where it matters that the stdout of the builtin gets flushed). --- zsh-forge/current/Src/exec.c Sat Jun 23 11:24:32 2001 +++ zsh-4.0/Src/exec.c Sat Jun 23 20:53:45 2001 @@ -2288,9 +2288,6 @@ #ifdef PATH_DEV_FD closem(2); #endif - if (isset(PRINTEXITVALUE) && isset(SHINSTDIN) && lastval && !subsh) { - fprintf(stderr, "zsh: exit %ld\n", (long)lastval); - } fflush(stdout); if (save[1] == -2) { if (ferror(stdout)) { @@ -2299,6 +2296,10 @@ } } else clearerr(stdout); + } + if (isset(PRINTEXITVALUE) && isset(SHINSTDIN) && + lastval && !subsh) { + fprintf(stderr, "zsh: exit %ld\n", (long)lastval); } if (do_exec) { -- Bart Schaefer Brass Lantern Enterprises http://www.well.com/user/barts http://www.brasslantern.com Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net