Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:64184 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 32222 invoked from network); 6 Dec 2012 15:29:32 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 6 Dec 2012 15:29:32 -0000 Authentication-Results: pb1.pair.com smtp.mail=pierre.php@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=pierre.php@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.220.42 as permitted sender) X-PHP-List-Original-Sender: pierre.php@gmail.com X-Host-Fingerprint: 209.85.220.42 mail-pa0-f42.google.com Received: from [209.85.220.42] ([209.85.220.42:42061] helo=mail-pa0-f42.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id BE/B0-27691-BD9B0C05 for ; Thu, 06 Dec 2012 10:29:31 -0500 Received: by mail-pa0-f42.google.com with SMTP id rl6so4323387pac.29 for ; Thu, 06 Dec 2012 07:29:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; bh=DYjOVczBSqrLsQL/DwYdjXMztXH1qadSvm0NySLmQq4=; b=JNLj67GwKC9JnSZAPLMeh9bDrJ7LirEsQgYqhRPEhjkLP5oEJWN0T0hObfb0PMgZl6 u0YecOIEhx+gr9yBMMb2EIMlnitcUeZsvaYaJuOXeTfnNnEKWPOq+WP5OsIck0uBt08b b7dpBk2JXiT0djxoHQasO+uOTqQrUax8efPFnvh671TgQHEt917aW+dwEpV4jLLUxN/V s7lJb7jS3K3Ybhwg/EepzdgPYDOI8gnvSyrqdnT3XVbkKVhWvFvKS4K+Qgj4mu74gltZ gxdpINNy+CLdGbSQdAi0aCYtTVRRE+sGqN2SVIWV1K5UHyPf7xRa9v//skESQB+47404 2eYA== MIME-Version: 1.0 Received: by 10.66.84.40 with SMTP id v8mr4907544pay.47.1354807769029; Thu, 06 Dec 2012 07:29:29 -0800 (PST) Received: by 10.66.86.5 with HTTP; Thu, 6 Dec 2012 07:29:28 -0800 (PST) In-Reply-To: <50C0B103.4070706@gmail.com> References: <50C0841E.6000507@gmail.com> <50C0B103.4070706@gmail.com> Date: Thu, 6 Dec 2012 16:29:28 +0100 Message-ID: To: =?ISO-8859-1?Q?=C1ngel_Gonz=E1lez?= Cc: PHP internals Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] Passing process handles to proc_open and co From: pierre.php@gmail.com (Pierre Joye) hi, On Thu, Dec 6, 2012 at 3:51 PM, =C1ngel Gonz=E1lez wrot= e: > On 06/12/12 13:52, Pierre Joye wrote: >> hi, >> >> On Thu, Dec 6, 2012 at 12:40 PM, =C1ngel Gonz=E1lez = wrote: >>> On 06/12/12 09:49, Pierre Joye wrote: >>>> hi! >>>> >>>> While looking at the bug #63073, I was wondering if we could simply do >>>> not pass open handles to the newly created child process. >>> Looking at proc_open, where there is an explicit CreateProcess (we seem >>> to be using the library popen for the exec()...) >> We use CreateProcess too for our windows popen implementation, see: >> >> http://lxr.php.net/xref/PHP_5_4/TSRM/tsrm_win32.c#450 > Oh, right. The filename confused me into thinking it was only used in ZTS= . > Yes, the popen called will be that one. > > >>> If $pipes is empty and $descriptorspec doesn't require more than 0,1,2 >>> then it should be safe not to set bInheritHandles. >>> >>> However, in other cases inheriting handles *will* be needed. >> hm, Why? > How else would you pass the child process the other side of a pipe ? > > (It's possible that the handles passed in STARTUPINFO hStdInput, > hStdOutput and hStdError still get automatically inherited, msdn > doesn't document that point, but it would still be relevant for higher > descriptors) Ah right, I was thinking about other handles. It seems that I may have found one possible cause, which may also cause the hang because we do not see the EOF. We should close the inherited handle after CreateProcess. And we should not always set inherit to true (as you stated earlier) when all 0-1 are given. I have to test all that in the coming days :) -- Pierre @pierrejoye