summaryrefslogtreecommitdiff
path: root/NEWS
diff options
context:
space:
mode:
authorCarl Edquist <edquist@cs.wisc.edu>2022-12-15 12:32:49 -0600
committerPádraig Brady <P@draigBrady.com>2023-02-28 14:02:42 +0000
commit6b12e62d9585726424b3105b84827d39380d7ab2 (patch)
treeb04ed6983707cb49012d53cd3260b09773aec494 /NEWS
parentb5c421a78431e707a3713df2de9e08e00f63feff (diff)
downloadcoreutils-6b12e62d9585726424b3105b84827d39380d7ab2.tar.gz
tee: enhance -p mode using iopoll() to detect broken pipe outputs
If input is intermittent (a tty, pipe, or socket), and all remaining outputs are pipes (eg, >(cmd) process substitutions), exit early when they have all become broken pipes (and thus future writes will fail), without waiting for more input to become available, as future write attempts to these outputs will fail (SIGPIPE/EPIPE). Only provide this enhancement when pipe errors are ignored (-p mode). Note that only one output needs to be monitored at a time with iopoll(), as we only want to exit early if _all_ outputs have been removed. * src/tee.c (pipe_check): New global for iopoll mode. (main): enable pipe_check for -p, as long as output_error ignores EPIPE, and input is suitable for iopoll(). (get_next_out): Helper function for finding next valid output. (fail_output, tee_files): Break out write failure/output removal logic to helper function. (tee_files): Add out_pollable array to track which outputs are suitable for iopoll() (ie, that are pipes); track first output index that is still valid; add iopoll() broken pipe detection before calling read(), removing an output that becomes a broken pipe. * src/local.mk (src_tee_SOURCES): include src/iopoll.c. * NEWS: Mention tee -p enhancement in Improvements. * doc/coreutils.texi: Mention the new early exit behavior in the nopipe modes for the tee -p option. Suggested-by: Arsen Arsenović <arsen@aarsen.me>
Diffstat (limited to 'NEWS')
-rw-r--r--NEWS4
1 files changed, 4 insertions, 0 deletions
diff --git a/NEWS b/NEWS
index 7c99bea19..2694cf305 100644
--- a/NEWS
+++ b/NEWS
@@ -153,6 +153,10 @@ GNU coreutils NEWS -*- outline -*-
when their modification time doesn't change when new data is available.
Previously tail would not show any new data in this case.
+ tee -p detects when all remaining outputs have become broken pipes, and
+ exits, rather than waiting for more input to induce an exit when written.
+
+
* Noteworthy changes in release 9.1 (2022-04-15) [stable]