[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: bash crashes on SIGPIPE
From: |
Chet Ramey |
Subject: |
Re: bash crashes on SIGPIPE |
Date: |
Tue, 14 Apr 2015 22:07:25 -0400 |
User-agent: |
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 |
On 4/14/15 2:46 PM, Nikola Kržalić wrote:
> I wonder if this is the correct behavior in interactive bash as well?
> Because if I do this via ssh my connection drops as well and I have to
> reconnect. Shouldn't just echo return a non-zero exit code?
Bash doesn't perform any special handling on receipt of SIGPIPE; it's
just another fatal signal. The kernel generates it when a process tries
to write to a pipe with no reader or an unconnected socket, interactive or
not. Bash doesn't (and shouldn't) try to handle it internally. If you
want to trap or ignore it, you or your script can decide on the right
thing to do.
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU chet@case.edu http://cnswww.cns.cwru.edu/~chet/