Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1XQHk5-00052l-No for pgsql-bugs@arkaria.postgresql.org; Sat, 06 Sep 2014 15:17:33 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1XQHk5-00069S-6q for pgsql-bugs@arkaria.postgresql.org; Sat, 06 Sep 2014 15:17:33 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1XQHk4-00067f-3n for pgsql-bugs@postgresql.org; Sat, 06 Sep 2014 15:17:32 +0000 Received: from momjian.us ([72.94.173.45]) by magus.postgresql.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.80) (envelope-from ) id 1XQHk1-0001vc-79 for pgsql-bugs@postgresql.org; Sat, 06 Sep 2014 15:17:30 +0000 Received: from bruce by momjian.us with local (Exim 4.72) (envelope-from ) id 1XQHjy-00076b-Ow; Sat, 06 Sep 2014 11:17:26 -0400 Date: Sat, 6 Sep 2014 11:17:26 -0400 From: Bruce Momjian To: Thomas Hruska Cc: pgsql-bugs@postgresql.org Subject: Re: BUG #10330: pg_ctl does not correctly honor "DETACHED_PROCESS" Message-ID: <20140906151726.GE20146@momjian.us> References: <53759381.4000205@cubiclesoft.com> <53759733.3040204@cubiclesoft.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <53759733.3040204@cubiclesoft.com> User-Agent: Mutt/1.5.20 (2009-06-14) X-Pg-Spam-Score: -3.6 (---) 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 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 http://momjian.us EnterpriseDB http://enterprisedb.com + Everyone has their own god. + -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs