Assaf Gordon wrote:
With the above change, if SIGPIPE is set to 'ignore' (e.g. by the shell or
python),
then grep would exit with "write error: Broken Pipe".
Based on recent suggestion from Pádraig Brady
I don't see why this is would be a good idea. grep should report write errors.
A caller that doesn't care about EPIPE output errors should invoke 'grep' with
the default behavior for SIGPIPE and should ignore grep's exit status; this is
longstanding tradition. As far as I can see, it's a mistake to ignore SIGPIPE
while expecting a status of zero with no output-error diagnostics. Such a
mistake would affect lots of programs other than 'grep', and it's not incumbent
on utility writers to work around mistakes like this.