|
From: | Neil R. Ormos |
Subject: | Re: no exit status available when a command doesn't exist or fails in pipe to grep |
Date: | Thu, 9 Sep 2021 17:04:08 -0500 (CDT) |
Ed Morton wrote: > Neil R. Ormos wrote: >> the notion that we somehow don't know what "if >> the close was successful" means is a fiction. > We'll have to agree to disagree. If someone told > me to write a function foo() to release some > resource X and return success if foo() succeeded > my first question would be "what should it > return if X is already idle". The inability to close() something because it was already closed or never opened in the first place is recognized as an "error" and the value returned by close() is -1. See the manual. That is the "otherwise" condition in the POSIX spec. As demonstrated earlier, a non-zero return code from some piped command (or the shell) does not defeat the operation of close(). Reiterating: it's Arnold and Andy you have to convince.
[Prev in Thread] | Current Thread | [Next in Thread] |