From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20385 invoked by alias); 18 Dec 2013 08:40:03 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 32147 Received: (qmail 23110 invoked from network); 18 Dec 2013 08:39:48 -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=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE, SPF_HELO_PASS autolearn=ham version=3.3.2 X-Injected-Via-Gmane: http://gmane.org/ To: zsh-workers@zsh.org From: Martin Vaeth Subject: Re: PATCH: Util/helpfiles failing on old-fashioned unix Date: Wed, 18 Dec 2013 08:39:24 +0000 (UTC) Message-ID: References: <131123210612.ZM31978@torch.brasslantern.com> <20131124175649.27c2559a@pws!> <-pc.ntlworld.com@samsung.com> <131125001818.ZM26494@torch.brasslantern.com> <691AC9C6-D832-42FC-B983-60C682AA5515@kba.biglobe.ne.jp> <20131125154954.14283de2@pwslap01u.europe.root.pri> <131125085631.ZM17483@torch.brasslantern.com> <20131212221744.GA27563@ma.sdf.org> <20131215233752.GA3644@ma.sdf.org> Reply-To: vaeth@mathematik.uni-wuerzburg.de X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: lounge.imp.fu-berlin.de User-Agent: slrn/pre1.0.0-26 (Linux) pda@sdf.org wrote: > Looking more closely > at how perl opens a pipe, I see it seems to always succeed, even when > the pipe components fail. I suppose perl just checks the call of the shell (and whether the redirection succeeeded) which means that, usually, an open with a pipe redirection succeeds fully (including the "close") if the *last* command of that pipe succeeded. > Looks like testing for emptiness of the file handle would do the trick. I doubt that perl has any means to get this information after a call to the shell. Moreover, filehandles in perl are very abstract objects (even more in perl{3,4}); you probably cannot get a useful string representation of it which has any meaning. I recall that, in another context, even with perl5 and its filehandle *variables* I did not find a proper way to find out the "succeess" from the handle, only (and I had tried some tricks with "ref" and "defined" but perl's autovivification seems to make the handle "well-behaved" just because it was *used* in a call to open - even if that call failed). However, with the code I had attached all these problems should not occur since it uses "system" only instead of "open".