Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Wl9yi-0006W3-IG for pgsql-bugs@arkaria.postgresql.org; Fri, 16 May 2014 04:42:40 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1Wl9yh-0007TE-PB for pgsql-bugs@arkaria.postgresql.org; Fri, 16 May 2014 04:42:39 +0000 Received: from makus.postgresql.org ([2001:4800:7903:4::125]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Wl9yg-0007T6-OW for pgsql-bugs@postgresql.org; Fri, 16 May 2014 04:42:38 +0000 Received: from u17593298.onlinehome-server.com ([2607:f1c0:845:4700::a1:cbf9]) by makus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Wl9yZ-0000Ns-HK for pgsql-bugs@postgresql.org; Fri, 16 May 2014 04:42:38 +0000 Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: thruska@cubiclesoft.com) with ESMTPSA id 8A50120175 Message-ID: <53759733.3040204@cubiclesoft.com> Date: Thu, 15 May 2014 21:42:27 -0700 From: Thomas Hruska User-Agent: Mozilla/5.0 (X11; Linux i686; rv:11.0) Gecko/20120327 Thunderbird/11.0.1 MIME-Version: 1.0 To: pgsql-bugs@postgresql.org Subject: Re: BUG #10330: pg_ctl does not correctly honor "DETACHED_PROCESS" References: <53759381.4000205@cubiclesoft.com> In-Reply-To: <53759381.4000205@cubiclesoft.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: 0.0 (/) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org 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