bug-gawk
[Top][All Lists]
Advanced

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

Re: [bug-gawk] Behavior of fflush with SIGPIPE on stdout [PATCH]


From: Andrew J. Schorr
Subject: Re: [bug-gawk] Behavior of fflush with SIGPIPE on stdout [PATCH]
Date: Sat, 25 Mar 2017 10:04:32 -0400
User-agent: Mutt/1.5.21 (2010-09-15)

On Sat, Mar 25, 2017 at 02:50:19PM +0100, FERRIEUX Alexandre - IMT/OLN wrote:
> >$ uname -a
> >CYGWIN_NT-10.0 ti47 2.5.0(0.297/5/3) 2016-04-11 09:58 x86_64 Cygwin
> >
> >$ false | head -1; echo $?
> >1
> >
> >$ cat /etc/services | head -1 ; echo $?
> ># Copyright (c) 1993-2004 Microsoft Corp.
> >0
> >
> >I don't know why that's the case.
> 
> You forgot "set -o pipefail".

I did not forget. If I had forgotten, the example with "false" above
would not have worked:

$ false | head -1; echo $?
0

$ set -o pipefail

$ false | head -1; echo $?
1

$ cat /etc/services | head -1; echo $?
# Copyright (c) 1993-2004 Microsoft Corp.
0

> Here is a variant that doesn't need it:
> 
>   (cat /etc/services;echo $?>&2) | head -1
>   # /etc/services:
>   141

Strangely, that does not work on my Cygwin system:

$ (cat /etc/services;echo $?>&2) | head -1
0
# Copyright (c) 1993-2004 Microsoft Corp.

I guess I may be experiencing a Cygwin bug of some sort. Did you actually
test on Cygwin?

Regards,
Andy



reply via email to

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