Re: BUG #10330: pg_ctl does not correctly honor "DETACHED_PROCESS"

From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Thomas Hruska <thruska(at)cubiclesoft(dot)com>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #10330: pg_ctl does not correctly honor "DETACHED_PROCESS"
Date: 2014-09-06 15:17:26
Message-ID: 20140906151726.GE20146@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Thu, May 15, 2014 at 09:42:27PM -0700, Thomas Hruska wrote:
> On 5/15/2014 9:26 PM, Thomas Hruska wrote:
> >Somewhere around line 4227 is this code:
> >
> > if (!CreateProcess(NULL, cmdLine, NULL, NULL, TRUE,
> >CREATE_SUSPENDED, NULL, NULL, &si, &pi))
> >
> >
> >Adding DETACHED_PROCESS should fix the problem of the OS spawning a
> >bunch of console windows when 'postgres.exe' is called directly without
> >an attached console:
> >
> >
> > if (!CreateProcess(NULL, cmdLine, NULL, NULL, TRUE,
> >CREATE_SUSPENDED | DETACHED_PROCESS, NULL, NULL, &si, &pi))
>
> Minor correction. Detect the lack of a console, THEN add DETACHED_PROCESS:
>
> if (!CreateProcess(NULL, cmdLine, NULL, NULL, TRUE,
> CREATE_SUSPENDED | (GetConsoleWindow() == NULL ? DETACHED_PROCESS :
> 0), NULL, NULL, &si, &pi))
>
> That should allow standard input/output handles to function as
> expected when there is a console.

Thomas, would you like to create a complete patch for this that we could
review?

--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://enterprisedb.com

+ Everyone has their own god. +

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2014-09-06 20:25:28 Re: BUG #11335: an invalid prepare statement causes crash at log_statement = 'mod' or 'ddl'.
Previous Message Bruce Momjian 2014-09-06 15:07:43 Re: Re: BUG #10329: Could not read block 0 in file "base/56100265/57047884": read only 0 of 8192 bytes