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