Re: [HACKERS] pg_basebackup --progress output for batch execution - Mailing list pgsql-hackers

From Martín Marqués
Subject Re: [HACKERS] pg_basebackup --progress output for batch execution
Date
Msg-id 284aea2f-aebb-aa22-ddb4-f7e0a4fe0575@2ndquadrant.com
Whole thread Raw
In response to Re: [HACKERS] pg_basebackup --progress output for batch execution  (Arthur Zakirov <a.zakirov@postgrespro.ru>)
Responses Re: [HACKERS] pg_basebackup --progress output for batch execution  (Arthur Zakirov <a.zakirov@postgrespro.ru>)
List 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
terminalusing 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

pgsql-hackers by date:

Previous
From: David Fetter
Date:
Subject: Re: [PATCH] Porting small OpenBSD changes.
Next
From: Tom Lane
Date:
Subject: Re: Using isatty() on WIN32 platform