Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: PATCH: Util/helpfiles failing on old-fashioned unix

pda@xxxxxxx <pda@xxxxxxx> 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".

Messages sorted by: Reverse Date, Date, Thread, Author