From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22968 invoked by alias); 25 Apr 2013 19:38:39 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: X-Seq: 17781 Received: (qmail 25086 invoked from network); 25 Apr 2013 19:38:28 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-0.7 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE, RCVD_NUMERIC_HELO,SPF_HELO_PASS autolearn=no version=3.3.2 Received-SPF: pass (ns1.primenet.com.au: SPF record at m.gmane.org designates 80.91.229.3 as permitted sender) X-Injected-Via-Gmane: http://gmane.org/ To: zsh-users@zsh.org From: Yuri D'Elia Subject: Re: precmd: write error: interrupted Date: Thu, 25 Apr 2013 21:38:13 +0200 Message-ID: References: <130425111646.ZM17258@torch.brasslantern.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: 193.106.183.18 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:10.0.12) Gecko/20130116 Icedove/10.0.12 In-Reply-To: <130425111646.ZM17258@torch.brasslantern.com> On 04/25/2013 08:16 PM, Bart Schaefer wrote: > On Apr 25, 6:47pm, Yuri D'Elia wrote: > } > } I still have the error, as I didn't find any way to silence it (braces > } around print do not work?!). > > That's curious, but try using parentheses to force a fork and redirect > the stderr of the subshell. This, of course, works. But I wouldn't want to fork here just to ignore the error message. > } I have no idea which write is actually failing in that function (I > } suppose it's some "fputs" in bin_print). > > strace should be able to show you what bytes are being written, which > would narrow it down. not really, apart from the "write error:" which I already knew. But there are only two possible points in bin_print, and I'm using the "unformatted" case. > } 2) Why "precmd() { { print "HELLO" }>&- 2>&-; } doesn't suppress the > } error in this case? > > It's not the same error. Try 2>/dev/null instead of 2>&- ... with the > stderr closed, you're actually getting a second error from outside the > braces, about not being able to write the first error from inside! You are right. I pasted one of my numerous trials in an attempt to exploit the EBADF errno. But anyway: precmd() { { print x } 2>/dev/null } still doesn't suppress the error. By looking at bin_print, zwarnnam is used. In the "normal output case" (Src/builtin.c:6310) there's an explicit test for >&- redirection of stdout, and that's it. I see nothing in zwarnnam except for the noerrs global that would allow error redirection to work in lists. Maybe there's a builtin to force "noerrs" instead?