Skip to content

Commit 041c449

Browse files
dbgreenCommitfest Bot
authored andcommitted
Fix pg_ctl on Windows to reliably detect already-running postmaster.
The previous implementation invoked postgres.exe via cmd.exe, which meant pg_ctl got the PID of the shell wrapper rather than the actual postmaster process. This caused problems in wait_for_postmaster_start(), which tries to verify that the PID in postmaster.pid matches the one we started. The mismatch led to a timing window where pg_ctl could incorrectly report success when attempting to start an already-running cluster. Fix by replacing the cmd.exe wrapper with a direct CreateProcess() call. This gives us the real postgres.exe PID immediately, eliminating the need for process tree walking or other heuristics to find the actual postmaster. We handle I/O redirection using Windows handle-based APIs instead of shell syntax, which is more reliable anyway.
1 parent 447aae1 commit 041c449

File tree

1 file changed

+369
-153
lines changed

1 file changed

+369
-153
lines changed

0 commit comments

Comments
 (0)