On Sat, Mar 25, 2017 at 11:49:31AM +0100, FERRIEUX Alexandre - IMT/OLN wrote:
On 25/03/2017 01:16, Andrew J. Schorr wrote:
>Why is it exiting successfully
>when it catches a SIGPIPE? As far as I can tell, that's not normal.
Agreed. And while you're at it, a full emulation of
exiting-with-default-SIGPIPE-handler would be even cleaner: exit
status should end up as 141 = 128+EPIPE.
cat /etc/services | head -1 ; echo $?
# /etc/services:
141
Hmmm. I'm not sure, but I suspect this may be platform-specific.
Actually, testing on Cygwin, I don't get any error at all:
$ 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.