Hi, On 2023-05-15 15:30:28 -0700, Andres Freund wrote: > As soon as either the pg_ctl for the start, or the whole bash invocation, has > stdin redirected, the problem vanishes.
For a moment I thought this could be related to InheritStdHandles() - but no, it doesn't make a difference. There's loads of handles referencing cygwin alive in pg_ctl. Based on difference in strace output for bash -c "pg_ctl stop" for the case where start redirected stdin (#1) and where not (#2), it looks like some part of msys / cygwin sees that stdin is alive when preparing to execute "pg_ctl stop", and then runs into trouble. The way we start the child process on windows makes the use of cmd.exe for redirection pretty odd. I couldn't trivially reproduce this with a much simpler case (just nohup sleep). Perhaps it's dependent on a wrapper cmd or such. Greetings, Andres Freund