Re: [Bug-wget] exit status problem with pipe

2018-10-22 Thread Peng Yu
Can wget at least allow 141 for pipes but not sockets? Many GNU tools
(such coreutiles) uses 141 for pipe signals. I'd like other programs
to follow the same convention so that I can use the exit_status for
error checking.

On 10/22/18, Darshit Shah  wrote:
> 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  [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
>


-- 
Regards,
Peng



Re: [Bug-wget] exit status problem with pipe

2018-10-22 Thread Darshit Shah
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  [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