]> granicus.if.org Git - postgresql/commit
Windows: Make pg_ctl reliably detect service status
authorAlvaro Herrera <alvherre@alvh.no-ip.org>
Thu, 7 Jan 2016 14:59:08 +0000 (11:59 -0300)
committerAlvaro Herrera <alvherre@alvh.no-ip.org>
Thu, 7 Jan 2016 14:59:08 +0000 (11:59 -0300)
commit744d01c9a188eef546dae6a4c3c4d0a19eb20a08
tree6e0ef44c2e7c2849a057101b01ad4b15ec55074e
parent9919f4fef1df2edf40e1a2a2971f97ff2d23cc3c
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
src/bin/pg_ctl/pg_ctl.c