This is difficult to do correctly for network applications. Is there any particular reason you're looking for identifying if Wget was killed by SIGPIPE?
The problem here is that a closed socket will also result in a SIGPIPE on unix systems. But in such a case, we don't want to kill the application. As a result, we simply ignore the SIGPIPE handler. So when Wget dies in the command you shared, its not really killed by SIGPIPE. Hence, in theory, it would be incorrect for Wget to exit with a code of 141. * Peng Yu <pengyu...@gmail.com> [181022 16:29]: > Hi, > > wget returns the following exit code when it is dealing with pipe. But > it does not follow the common practice. Should this behavior be fixed? > > $ wget -qO- http://httpbin.org/get | echo > > $ echo ${PIPESTATUS[@]} > 3 0 > $ seq 10 | echo > > $ echo ${PIPESTATUS[@]} > 141 0 > > -- > Regards, > Peng > > -- Thanking You, Darshit Shah PGP Fingerprint: 7845 120B 07CB D8D6 ECE5 FF2B 2A17 43ED A91A 35B6
signature.asc
Description: PGP signature