Re: Progress reporting for pg_verify_checksums
Alvaro Herrera <alvherre@2ndquadrant.com>
From: Alvaro Herrera <alvherre@2ndquadrant.com>
To: Michael Paquier <michael@paquier.xyz>
Cc: Fabien COELHO <coelho@cri.ensmp.fr>, Michael Banck <michael.banck@credativ.de>, Thomas Munro <thomas.munro@enterprisedb.com>, Bernd Helmle <bernd.helmle@credativ.de>, Pg Hackers <pgsql-hackers@postgresql.org>
Date: 2018-12-26T02:45:09Z
Lists: pgsql-hackers
On 2018-Dec-26, Michael Paquier wrote: > + /* > + * If we are reporting to a terminal, send a carriage return so that we > + * stay on the same line. If not, send a newline. > + */ > + if (isatty(fileno(stderr))) > + fprintf(stderr, "\r"); > + else > + fprintf(stderr, "\n"); > This bit is not really elegant, why not just '\r'? Umm, this is established coding pattern in pg_basebackup.c. Stylistically I'd change all those cases to "fprintf(stderr, isatty(fileno(stderr)) ? "\r" : "\n")" but leave the string alone, since AFAIR it took some time to figure out what to do. (I'd also make the comment one line instead of four, say "Stay on the same line if reporting to a terminal". That makes the whole stanza two lines rather than eight, which is the appropriate amount of space for it). -- Álvaro Herrera https://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
Commits
-
Add progress reporting to pg_checksums
- 280e5f14056b 12.0 landed
-
Fix thinko when bumping on temporary directories in pg_verify_checksums
- da453004869d 11.3 landed
-
Fix thinko when bumping on temporary directories in pg_checksums
- 6eebfdc38b17 12.0 landed