From a9550383603b76efdf6e867dc0605032b7c09176 Mon Sep 17 00:00:00 2001 From: Andrew Wood Date: Tue, 21 Apr 2026 22:13:44 +0100 Subject: [PATCH] Document the behaviour exhibited when pv writes to a pipe and the reader exits with unread data in the pipe buffer. --- docs/pv.1 | 10 +++++++++- docs/pv.1.md | 6 ++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/docs/pv.1 b/docs/pv.1 index a1a2843..4de5e11 100644 --- a/docs/pv.1 +++ b/docs/pv.1 @@ -1,4 +1,4 @@ -.TH PV 1 2026-04-19 pv-1.11.0 "User Commands" +.TH PV 1 2026-04-21 pv-1.11.0 "User Commands" .\" .SH NAME pv \- monitor and manage the progress of data through a pipe @@ -877,6 +877,14 @@ a file, that file may look like it has stopped growing if inspected with reports progress. This is because of the way sparse output is achieved, and the file will be the correct size when the transfer ends. +.PP +If \fBpv\fR is writing to a pipe, and the command reading that pipe exits, +\fBpv\fR will only know that has happened when it \fInext\fR receives some +input data to transfer. +So \*(lq\fBecho\~|\~pv\~|\~sleep\~1\fR\*(rq will wait forever, but +\*(lq\fB{\~echo;\~sleep\~3;\~echo;\~}\~|\~pv\~|\~sleep\~1\fR\*(rq will +end after 3 seconds when \fBpv\fR tries to transfer the second line of +input. .\" .SH REPORTING BUGS Please report bugs or feature requests via the issue tracker linked from the diff --git a/docs/pv.1.md b/docs/pv.1.md index fb0f874..4b8becf 100644 --- a/docs/pv.1.md +++ b/docs/pv.1.md @@ -831,6 +831,12 @@ that file may look like it has stopped growing if inspected with reports progress. This is because of the way sparse output is achieved, and the file will be the correct size when the transfer ends. +If **pv** is writing to a pipe, and the command reading that pipe exits, +**pv** will only know that has happened when it *next* receives some +input data to transfer. So "**echo \| pv \| sleep 1**" will wait +forever, but "**{ echo; sleep 3; echo; } \| pv \| sleep 1**" will end +after 3 seconds when **pv** tries to transfer the second line of input. + # REPORTING BUGS Please report bugs or feature requests via the issue tracker linked from