help-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: weird interaction between builtin cat and trap


From: Peng Yu
Subject: Re: weird interaction between builtin cat and trap
Date: Tue, 19 Apr 2022 12:01:40 -0500

On 4/18/22, Chet Ramey <chet.ramey@case.edu> wrote:
> On 4/15/22 2:34 PM, Peng Yu wrote:
>
>>> The `same behavior' here is dying due to SIGPIPE before checking for a
>>> write error. Is that the hill you're dying on?
>>
>> The point is that this error for builtin cat should be ignored.
>
> So EPIPE should be ignored.
>
>> Another way to demonstrate the problem is the even simpler code. There
>> is no point to generate this kind of error. Otherwise, the external
>> cat would have done so already.
>
> This is just another example of the same scenario.
> There's nothing new
> here.

Yes and no. "No" in the sense, that `some_command_general_long_output
| cat | head` is a common enough use case for with SIGPIPE error
should not result in an error message. Users mostly likely don't want
to see the SIGPIPE error message but just the first 10 lines output by
head.

> You want SIGPIPE-before-write-error behavior and the builtin cat
> doesn't do things in that order.

-- 
Regards,
Peng



reply via email to

[Prev in Thread] Current Thread [Next in Thread]