On 2021-06-05 07:00, Masahiro Yamada wrote:
  make 2>&1 | tee build.log

is a very common use case, and people often
miss to add  (trap "" 2; ...), I think.

Hi Masahiro,

tee has a -i option to ignore the SIGINT signal.
This is even specified by POSIX!

Might that help in this specific scenario?

(If tee ignores the SIGINT signal, how does it then terminate?
make will quit first, and then tee reacts to the EOF on its standard
input.)

If that helps, consider that the filename arguments in tee are optional;
tee copies stdin to stdout while duplicating the stream to
*zero* or more files.

Thus:

   make | tee -i | grep ....

Whoever added this -i option might have intended it
for exactly this scenario: as a pipe element that protects the
previous element from SIGPIPE.

The Coreutils tee's documentation says that -i ignores interrupt
signals (suggesting more than one) but strace reveals only
this:

rt_sigaction(SIGINT, {sa_handler=SIG_IGN, sa_mask=[INT], sa_flags=SA_RESTART}, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=0}, 8) = 0



Reply via email to