From: | Arthur Zakirov <a(dot)zakirov(at)postgrespro(dot)ru> |
---|---|
To: | Martín Marqués <martin(at)2ndquadrant(dot)com> |
Cc: | Jeff Janes <jeff(dot)janes(at)gmail(dot)com>, PostgreSQL mailing lists <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: [HACKERS] pg_basebackup --progress output for batch execution |
Date: | 2017-11-14 09:25:47 |
Message-ID: | 20171114092546.GA22221@zakirov.localdomain |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Fri, Nov 10, 2017 at 10:32:23AM -0300, Martín Marqués wrote:
> An example where using isatty() might fail is if you run pg_basebackup
> from a tty but redirect the output to a file, I believe that in that
> case isatty() will return true, but it's very likely that the user
> might want batch mode output.
Sorry if I misunderstood you. I think this can happen if you redirect only standard output (stdout) to a file.
But pg_basebackup writes messages to stderr. So you need redirect stderr too:
pg_basebackup -D data -X stream -R --progress --verbose &> backup
or
pg_basebackup -D data_repl -X stream -R --progress --verbose > backup 2>&1
If you redirect stderr too then isatty() will know that message output is not tty.
--
Arthur Zakirov
Postgres Professional: http://www.postgrespro.com
Russian Postgres Company
From | Date | Subject | |
---|---|---|---|
Next Message | Moon Insung | 2017-11-14 09:36:30 | RE: [HACKERS][PATCH]pg_buffercache add a buffer state column, Add fuction to decode buffer state |
Previous Message | Andres Freund | 2017-11-14 09:06:53 | Re: [PATCH]pg_buffercache add a buffer state column, Add fuction to decode buffer state |