Bruno Haible <[EMAIL PROTECTED]> wrote:
> Andreas Schwab wrote:
>> > How about adding an option '-p' to 'tee', that causes it to ignore SIGPIPE
>> > while writing to stdout?
>>
>> Just add a trap '' SIGPIPE before starting tee.
>
> Thanks, this does half of the trick: Each 'tee' invocation then writes
> the complete stdin contents to the log file. But each 'tee' invocation also
> complains:
>
>   tee: standard output: Broken pipe
>   tee: write error
>   tee: standard output: Broken pipe
>   tee: write error
>   ...
>
> I don't see any better solution than putting support for this into 'tee'
> itself. Jim, here's a patch.
>
> From 9813ded2983b0a7f276dc249e68a246bf9c1686a Mon Sep 17 00:00:00 2001
> From: Bruno Haible <[EMAIL PROTECTED]>
> Date: Tue, 1 Jul 2008 02:22:10 +0200
> Subject: [PATCH]         New tee option -p.
>          * src/tee.c (ignore_sigpipe): New variable.
>          (long_options): Add option -p.
>          (usage): Document option -p.
>          (main): Handle option -p.
>          (tee_files): When option -p is specified, ignore SIGPIPE write 
> errors.
>          * doc/coreutils.texi (tee invocation): Document option -p.

Hi Bruno,

Thanks for the patch, but I'm reluctant to use it
in part because it covers only the write syscalls deriving
from tee's explicit fwrite call.  It does not handle
an EPIPE failure that comes of a close_stdout-induced
write syscall, so you'd still get the offending diagnostics
some of the time.


_______________________________________________
Bug-coreutils mailing list
Bug-coreutils@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-coreutils

Reply via email to