bug-gawk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: no exit status available when a command doesn't exist or fails in pi


From: Ed Morton
Subject: Re: no exit status available when a command doesn't exist or fails in pipe to grep
Date: Thu, 9 Sep 2021 11:47:23 -0500
User-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.13.0

On 9/9/2021 11:29 AM, Andrew J. Schorr wrote:
On Thu, Sep 09, 2021 at 10:52:57AM -0500, Ed Morton wrote:
Since POSIX doesn't define "succesful" in the context of calling
close() it can mean whichever we want it to mean and in the above
example I'd hope we'd go with "b" and get results from calling
close() like:

0 (success) = the action we took caused the command to close, or
N (failure) = or our attempt to close it failed for reason N (which
includes why it was already closed if that was the case)

since that would be much more useful than just 0 if the command is
closed or N if our attempt to close it failed and lose the
information about why it was already closed before we tried to close
it if that was the case.
Stupid question: why are you running gawk in --posix mode if you're
going to depend on gawk-specific behavior?
I wanted to see what it'd output since the POSIX standard is vague. I'm not relying on gawk-specific behavior, I'm using it for best error detection/reporting if/when it's available in a portable script (see the `cmdsub()` function at the bottom of https://stackoverflow.com/questions/69074464/awk-append-text-to-specific-line-with-systemexternal-programm-substitution/69074979#69074979).

    Ed.
  If you're developing a solution
that will depend on gawk's implementation choices, why use --posix?
Without --posix, gawk already does what you want.

Regards,
Andy




reply via email to

[Prev in Thread] Current Thread [Next in Thread]