bug-coreutils
[Top][All Lists]
Advanced

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

Re: tee logs no output if stdout is closed


From: Jim Meyering
Subject: Re: tee logs no output if stdout is closed
Date: Tue, 01 Jul 2008 22:50:29 +0200

Bruno Haible <address@hidden> 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 <address@hidden>
> 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.




reply via email to

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