pgsql: Windows: Make pg_ctl reliably detect service status

From: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Windows: Make pg_ctl reliably detect service status
Date: 2016-01-07 15:01:40
Message-ID: E1aHC4K-00057a-Mk@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Windows: Make pg_ctl reliably detect service status

pg_ctl is using isatty() to verify whether the process is running in a
terminal, and if not it sends its output to Windows' Event Log ... which
does the wrong thing when the output has been redirected to a pipe, as
reported in bug #13592.

To fix, make pg_ctl use the code we already have to detect service-ness:
in the master branch, move src/backend/port/win32/security.c to src/port
(with suitable tweaks so that it runs properly in backend and frontend
environments); pg_ctl already has access to pgport so it Just Works. In
older branches, that's likely to cause trouble, so instead duplicate the
required code in pg_ctl.c.

Author: Michael Paquier
Bug report and diagnosis: Egon Kocjan
Backpatch: all supported branches

Branch
------
REL9_2_STABLE

Details
-------
http://git.postgresql.org/pg/commitdiff/5c4cbd5d103c681a8cad586bac3588029ae44590

Modified Files
--------------
src/bin/pg_ctl/pg_ctl.c | 160 ++++++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 159 insertions(+), 1 deletion(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2016-01-07 16:19:39 pgsql: Provide more detail in postmaster log for password authenticatio
Previous Message Tom Lane 2016-01-06 17:25:38 pgsql: In initdb's post-bootstrap phase, drop temp tables explicitly.