Honour the --force setting when writing the progress display

This commit is contained in:
Andrew Wood
2023-07-16 21:58:08 +01:00
parent c8090806f9
commit bcb33ce2aa
5 changed files with 19 additions and 5 deletions
+2
View File
@@ -72,6 +72,8 @@ is acknowledged and greatly appreciated:
* Johannes Gerer <http://johannesgerer.com> - suggested that "`-B`" should enable "`-C`"
* Sam James - provided fix for number.c build issue caused by missing stddef.h
* Jakub Wilk <jwilk@jwilk.net> - corrected README encoding
* Frederik Eaton - reported issue with `<()` shell constructs
* [gray](https://github.com/gray) - reported issue with "`--force`" and terminal process groups, and proposed a patch
* [Luc Gommans](https://github.com/lgommans) / https://lgms.nl/ - provided a "momentary ETA" patch
* [ikasty](https://github.com/ikasty) - added relative filename display to "`--watchfd`"
* [Michael Weiß](https://github.com/quitschbo) - corrected behaviour when not attached to a terminal
+2 -1
View File
@@ -1,8 +1,9 @@
UNRELEASED
* dropped: support for Red Hat Enterprise Linux and its derivatives has been dropped; removed the RPM spec file, and will no longer build binaries
* fix: correction to `pv_in_foreground()` to behave as its comment block says it should, when not on a terminal - corrects [GH#19 "No output in Arch Linux initcpio after 1.6.6"](https://github.com/a-j-wood/pv/issues/19), [GH#55 "pv Stopped Working in the Background"](https://github.com/a-j-wood/pv/issues/55) (pull request [#64](https://github.com/a-j-wood/pv/pull/64) supplied by [Michael Weiß](https://github.com/quitschbo))
* fix: correction to `pv_in_foreground()` to behave as its comment block says it should, when not on a terminal - corrects [GH#19 "No output in Arch Linux initcpio after 1.6.6"](https://github.com/a-j-wood/pv/issues/19), [GH#31 "No output written from inside zsh <() construct"](https://github.com/a-j-wood/pv/issues/31), [GH#55 "pv Stopped Working in the Background"](https://github.com/a-j-wood/pv/issues/55) (pull request [#64](https://github.com/a-j-wood/pv/pull/64) supplied by [Michael Weiß](https://github.com/quitschbo))
* fix: workaround for OS X 11 behaviour in configure script regarding stat64 at compile time (pull request [#57](https://github.com/a-j-wood/pv/pull/57) supplied by [Dave Beckett](https://github.com/dajobe))
* fix: add burst rate limit to transfer, so rate limits are not broken by bursty traffic (pull request [#62](https://github.com/a-j-wood/pv/pull/62) supplied by [Volodymyr Bychkovyak](https://github.com/vbychkoviak))
* fix: corrected "`--force`" option so it will still output progress when not in the same process group as the owner of the terminal - corrects [GH#23 "No output with "`-f`" when run in background after 1.6.6"](https://github.com/a-j-wood/pv/issues/23) and helps to correct [GH#31 "No output written from inside zsh <() construct"](https://github.com/a-j-wood/pv/issues/31)
* feature: the "`--size`" option now accepts "`@filename`" to use the size of another file (pull request [#57](https://github.com/a-j-wood/pv/pull/57) supplied by [Dave Beckett](https://github.com/dajobe))
* feature: the "`--watchfd`" option is now available on OS X (pull request [#60](https://github.com/a-j-wood/pv/pull/60) supplied by [christoph-zededa](https://github.com/christoph-zededa))
* feature: new "`--average-rate-window`" option, to set the window over which the average rate is calculated, also used for ETA (modified from pull request [#65](https://github.com/a-j-wood/pv/pull/65) supplied by [lemonsqueeze](https://github.com/lemonsqueeze))
-2
View File
@@ -8,11 +8,9 @@ Bugs
* ([GH#16](https://github.com/a-j-wood/pv/issues/16)) Show days in same format in ETA as in elapsed time
* ([GH#18](https://github.com/a-j-wood/pv/issues/18)) No output in Cygwin from 1.6.19 onwards (Jacek M. Holeczek)
* ([GH#20](https://github.com/a-j-wood/pv/issues/20)) Terminal state is not restored correctly in all cases (VA)
* ([GH#23](https://github.com/a-j-wood/pv/issues/23)) No output with "`-f`" when run in background after 1.6.6 (gray)
* ([GH#24](https://github.com/a-j-wood/pv/issues/24)) Race condition with multiple "`pv -c`" leaves terminal state inconsistent (Lars Ellenberg, Viktor Ashirov)
* ([GH#26](https://github.com/a-j-wood/pv/issues/26)) Correct "`-n`" behaviour when going past 100% of "`-s`" size (Marcel)
* ([GH#27](https://github.com/a-j-wood/pv/issues/27)) Rate limit downgrade can take a long time to take effect (Stephen Kitt)
* ([GH#31](https://github.com/a-j-wood/pv/issues/31)) No output written from inside zsh `<()` construct (Frederik Eaton - Dec 2015)
* ([GH#33](https://github.com/a-j-wood/pv/issues/33)) Fix compilation problems due to `stat64()` on Apple Silicon (Filippo Valsorda - Jan 2021)
* ([GH#34](https://github.com/a-j-wood/pv/issues/34)) Continue timer even if input or output is blocking (Martin Probst - Jun 2017)
+13
View File
@@ -590,6 +590,19 @@ The following problems are known to exist in
.BR @PACKAGE@ :
.TP
.B *
In some versions of
.BR bash (1)
and
.BR zsh (1),
the construct
.B <(pv filename)
will not output any progress to the terminal when run from an interactive
shell, due to the subprocess being run in a separate process group from the
one that owns the terminal. In these cases, use
.BR \-\-force .
.P
.TP
.B *
The
.B -c
option does not work properly on Cygwin without
+2 -2
View File
@@ -1041,12 +1041,12 @@ void pv_display(pvstate_t state, long double esec, long long sl,
if (state->numeric) {
write(STDERR_FILENO, display, strlen(display));
} else if (state->cursor) {
if (pv_in_foreground()) {
if (state->force || pv_in_foreground()) {
pv_crs_update(state, display);
state->display_visible = true;
}
} else {
if (pv_in_foreground()) {
if (state->force || pv_in_foreground()) {
write(STDERR_FILENO, display, strlen(display));
write(STDERR_FILENO, "\r", 1);
state->display_visible = true;