BUG #3462: pg_ctl error output cannot be redirected

From: "Eugene Gershnik" <gershnik(at)hotmail(dot)com>
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #3462: pg_ctl error output cannot be redirected
Date: 2007-07-18 03:19:20
Message-ID: 200707180319.l6I3JKgE024141@wwwmaster.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs


The following bug has been logged online:

Bug reference: 3462
Logged by: Eugene Gershnik
Email address: gershnik(at)hotmail(dot)com
PostgreSQL version: 8.2.4
Operating system: Windows
Description: pg_ctl error output cannot be redirected
Details:

On Windows an attempt to do

pg_ctl ... > file.txt 2>&1

where ... stands for any parameters that make pg_ctl fail sends stderr
output to event log rather than file.txt.
This is caused by the following incorrect test in pg_ctl.c in function
write_stderr(const char *fmt,...)

if (!isatty(fileno(stderr)))
...

This test will succeed for anything other than console being stderr. It is
obviously incorrect since when the output is redirected to a file or pipe
you also want to print it rather than to send it to event log. What you need
to test is whether GetStdHandle returns an invalid handle.

Browse pgsql-bugs by date

  From Date Subject
Next Message Alex 2007-07-18 09:26:46 BUG #3467: Sum strange behaviour
Previous Message Bruce Momjian 2007-07-18 03:14:43 Re: [BUGS] BUG #3431: age() gets the days wrong