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

From: Thomas Hruska <thruska(at)cubiclesoft(dot)com>
To: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #10330: pg_ctl does not correctly honor "DETACHED_PROCESS"
Date: 2014-05-16 04:42:27
Message-ID: 53759733.3040204@cubiclesoft.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

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 Hruska
CubicleSoft President

I've got great, time saving software that you will find useful.

http://cubiclesoft.com/

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message hikkis21c 2014-05-16 07:20:39 BUG #10338: could not read block
Previous Message Thomas Hruska 2014-05-16 04:26:41 Re: BUG #10330: pg_ctl does not correctly honor "DETACHED_PROCESS"