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: Bruno Haible
Subject: Re: tee logs no output if stdout is closed
Date: Fri, 3 Oct 2008 15:29:19 +0200
User-agent: KMail/1.5.4

Paolo Bonzini wrote:
> > If you want both scenarios - the "don't know which of the two terminates 
> > first"
> > and the "writer must terminate first" - to be supported by close_stream and
> > close_stdout, IMO the program needs to be able to tell these functions about
> > it, probably through a global variable 'bool ignore_epipe' or similar.
> 
> I think this is not necessary.  Most of the time, programs have no need
> to distinguish *which* pipe was in error, so they are okay with SIGPIPE
> or SIGCHLD.  The global would be needed for programs that deal with
> multiple pipes, cannot rely on SIGCHLD (including the case when they
> want to be 100% correct and don't want to muddle with
> async-signal-safety), *and* need to error out if the reader terminates
> first.

I think you have misunderstood something.

We are discussing different scenarios where SIGPIPE is set to SIG_IGN.

SIGCHLD is not usable because - as Jim pointed out - there may not be a
parent-child relationship between the pipe writer and the pipe reader,
and SIGCHLD is a can of worms anyway (race conditions).

Jim's scenario is "writer must terminate first", and if the reader terminates
first, the writer should show an error message.

My scenario is "don't know which of the two terminates first", and if the
reader terminates first, the writer should acknowledge it and continue
its normal processing.

What else do you propose to cover these cases, if not a global variable?

Bruno





reply via email to

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