pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Thomas Hruska <thruska@cubiclesoft.com>
To: pgsql-bugs@postgresql.org
Subject: Re: BUG #10330: pg_ctl does not correctly honor "DETACHED_PROCESS"
Date: Thu, 15 May 2014 21:42:27 -0700
Message-ID: <53759733.3040204@cubiclesoft.com> (raw)
In-Reply-To: <53759381.4000205@cubiclesoft.com>
References: <53759381.4000205@cubiclesoft.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-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/


-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs



view thread (5+ messages)  latest in thread

Message-ID: <53759733.3040204@cubiclesoft.com>
Permalink:  ../53759733.3040204@cubiclesoft.com/
Also on:    postgresql.org/message-id/53759733.3040204@cubiclesoft.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: thruska@cubiclesoft.com
  Subject: Re: BUG #10330: pg_ctl does not correctly honor "DETACHED_PROCESS"
  In-Reply-To: <53759733.3040204@cubiclesoft.com>
  References: <53759381.4000205@cubiclesoft.com> <53759733.3040204@cubiclesoft.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox