Re: [HACKERS] pg_basebackup --progress output for batch execution

From: Martín Marqués <martin(at)2ndquadrant(dot)com>
To: Arthur Zakirov <a(dot)zakirov(at)postgrespro(dot)ru>
Cc: PostgreSQL mailing lists <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [HACKERS] pg_basebackup --progress output for batch execution
Date: 2017-11-20 19:45:48
Message-ID: 284aea2f-aebb-aa22-ddb4-f7e0a4fe0575@2ndquadrant.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

El 09/11/17 a las 09:29, Arthur Zakirov escribió:
> Hello,
>
> On Sun, Oct 01, 2017 at 04:49:17PM -0300, Martin Marques wrote:
>> Updated patch with documentation of the new option.
>>
>
> I have checked the patch.
> The patch is applied and compiled correctly without any errors. Tests passed.
> The documentation doesn't have errors too.
>
>
> I have a little suggestion. Maybe insert new line without any additional parameters? We can check that stderr is not terminal using isatty().
>
> The code could become:
>
> if (!isatty(fileno(stderr)))
> fprintf(stderr, "\n");
> else
> fprintf(stderr, "\r");
>
> Also it could be good to not insert new line after progress:
>
> if (showprogress)
> {
> progress_report(PQntuples(res), NULL, true);
> /* if (!batchmode) */
> /* or */
> if (isatty(fileno(stderr)))
> fprintf(stderr, "\n"); /* Need to move to next line */
> }

New version of patch, without the --batch-mode option and using isatty()

I send in a separate thread a proposal to make isatty() be defined as
_isatty() in windows.

--
Martín Marqués http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services

Attachment Content-Type Size
pg_basebackup-using-isatty.patch text/x-patch 1.6 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2017-11-20 19:53:24 Re: Using isatty() on WIN32 platform
Previous Message Andres Freund 2017-11-20 19:18:45 Re: [HACKERS] [COMMITTERS] pgsql: Fix freezing of a dead HOT-updated tuple