coreutils
[Top][All Lists]
Advanced

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

Re: [PATCH] tee: Add --pipe-check to allow instantly detecting closed ou


From: Arsen Arsenović
Subject: Re: [PATCH] tee: Add --pipe-check to allow instantly detecting closed outputs
Date: Sun, 27 Nov 2022 16:54:10 +0100

Hi,

Pádraig Brady <P@draigBrady.com> writes:

> I vaguely remember on macos that POLLRDBAND needed to be set on read fds for 
> select,
> though didn't check all combinations since we didn't actually need
> the poll() replacement.  Also select() (emulation of poll) doesn't work on
> Solaris or AIX, so we needed to explicitly disable emulation there.

Ah, hmm.  I don't know how notification APIs work there, maybe some
other one can be picked?  (IIRC Windows also has it's own set of
notification APIs that Gnulib uses when on Windows)

> Perhaps we could adjust poll() emulation to be compat everywhere,
> but I'm not confident.

I see.  I'll try to dig around a bit for notes about these platforms
(IIRC the libevent manual documented a bunch of weird notification API
quirks across platforms) to see how to reliably wait on pipes becoming
either readable, closed, or writable, if possible at all.

> We can help test on esoteric systems,
> especially if appropriate tests are in place.

More of a reason to figure out the test then :).  On that topic, I did
come up with a testcase that should be appropriate for the Coreutils
testsuite, but it takes a while to execute (5s), which is something to
consider.  Here it is:

  ( sleep 5 | (timeout 3 tee -P && echo g >&2) | : ) 2>&1 | grep -q g

The 5s time is no coincidence ;).  Maybe a better tool exists, that I'm
unaware of, that would just idly wait on stdout to become unwritable
(which sounds suspiciously like the issue this patch addresses ;).
Expect might also be able to handle this test, but I'm not sure whether
that's available in the testsuite.

> Note https://www.nongnu.org/pretest/ which may be useful.

I'll play around with this a bit later, too.

Thanks, have a lovely evening.
-- 
Arsen Arsenović

Attachment: signature.asc
Description: PGP signature


reply via email to

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