zsh-workers
 help / color / mirror / code / Atom feed
* [PATCH] make the doc of pipefail clear
@ 2015-04-10  1:16 Han Pingtian
  2015-04-10  1:53 ` Bart Schaefer
  0 siblings, 1 reply; 3+ messages in thread
From: Han Pingtian @ 2015-04-10  1:16 UTC (permalink / raw)
  To: zsh-workers

Hi, 

I think we can make the doc of pipefail more clear with this patch:



If set, pipe will return non-zero if any element return non-zero.
Otherwise, pipe will return zero.

Signed-off-by: Han Pingtian <hanpt@linux.vnet.ibm.com>
---
 Doc/Zsh/options.yo | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/Doc/Zsh/options.yo b/Doc/Zsh/options.yo
index 19920ca..cdfe46e 100644
--- a/Doc/Zsh/options.yo
+++ b/Doc/Zsh/options.yo
@@ -1743,8 +1743,8 @@ item(tt(PIPE_FAIL))(
 By default, when a pipeline exits the exit status recorded by the shell
 and returned by the shell variable tt($?) reflects that of the
 rightmost element of a pipeline.  If this option is set, the exit status
-instead reflects the status of the rightmost element of the pipeline
-that was non-zero, or zero if all elements exited with zero status.
+is non-zero if there was one element in the pipeline who exited with
+non-zero status, or zero if all elements exited with zero status.
 )
 pindex(SOURCE_TRACE)
 pindex(NO_SOURCE_TRACE)
-- 
1.9.3


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] make the doc of pipefail clear
  2015-04-10  1:16 [PATCH] make the doc of pipefail clear Han Pingtian
@ 2015-04-10  1:53 ` Bart Schaefer
  2015-04-10  3:14   ` Han Pingtian
  0 siblings, 1 reply; 3+ messages in thread
From: Bart Schaefer @ 2015-04-10  1:53 UTC (permalink / raw)
  To: zsh-workers

On Apr 10,  9:16am, Han Pingtian wrote:
} 
} I think we can make the doc of pipefail more clear with this patch:

It might be more clear, but it's less correct.

Given

    setopt pipefail
    ( exit 1 ) | ( exit 2 ) | ( exit 3 ) | ( exit 4 ) | ( exit 0 )

the original doc fully describes that the exit status of the entire
pipeline is 4, whereas your change only states that it is "non-zero".

That part about "the rightmost" that you removed, is important.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] make the doc of pipefail clear
  2015-04-10  1:53 ` Bart Schaefer
@ 2015-04-10  3:14   ` Han Pingtian
  0 siblings, 0 replies; 3+ messages in thread
From: Han Pingtian @ 2015-04-10  3:14 UTC (permalink / raw)
  To: zsh-workers

On Thu, Apr 09, 2015 at 06:53:38PM -0700, Bart Schaefer wrote:
> On Apr 10,  9:16am, Han Pingtian wrote:
> } 
> } I think we can make the doc of pipefail more clear with this patch:
> 
> It might be more clear, but it's less correct.
> 
> Given
> 
>     setopt pipefail
>     ( exit 1 ) | ( exit 2 ) | ( exit 3 ) | ( exit 4 ) | ( exit 0 )
> 
> the original doc fully describes that the exit status of the entire
> pipeline is 4, whereas your change only states that it is "non-zero".
> 
> That part about "the rightmost" that you removed, is important.

Thanks. Now I understand the original document ...


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-04-10  8:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-04-10  1:16 [PATCH] make the doc of pipefail clear Han Pingtian
2015-04-10  1:53 ` Bart Schaefer
2015-04-10  3:14   ` Han Pingtian

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).