Re: svn: /php/php-src/ branches/PHP_5_3/NEWS branches/PHP_5_3/TSRM/tsrm_win32.c trunk/TSRM/tsrm_win32.c
| From: | Garrett Serack | Date: | Wed, 19 Aug 2009 19:55:23 +0000 |
| Subject: | Re: svn: /php/php-src/ branches/PHP_5_3/NEWS branches/PHP_5_3/TSRM/tsrm_win32.c trunk/TSRM/tsrm_win32.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-60189@lists.php.net to get a copy of this message | ||
Howdy,
There are a couple of issues with making all child processes go thru cmd.exe.
Initially, this prevents popen_ex from failing when the actual executable doesn't exist, since
"cmd.exe /c c:\foo\bar\xxx.exe" will *always* successfully start a process. This can be
seen in bug #43327.
Second, is that by having the intermediate process, I'm pretty sure there's some
extra-buffering of the input/output streams going on (once for the child proc, and once for the
cmd.exe). This (probably along with a too-small pipe buffer) contributes to the behavior found in
#44994.
Finally, I can't for the life of me see what benefit this brings to the table. Other languages
don't need to put cmd.exe in the middle of their children. The only case may be where someone
wants to use built-in cmd.exe commands like 'dir' on popen_ex() , which would not be right
anyway, and they should explicitly include the command processor in their command line.
If fixing this causes a problem elsewhere, we're better off fixing that appropriately, rather
than dragging around a redundant copy of the command processor for every child process.
Hi!
- cmd = (char*)malloc(strlen(command)+strlen(TWG(comspec))+sizeof(" /c ")+2);
- sprintf(cmd, "%s /c \"%s\"", TWG(comspec), command);
- if (!CreateProcess(NULL, cmd, &security, &security, security.bInheritHandle,
dwCreateFlags, env, cwd, &startup, &process)) {
+ if (!CreateProcess(NULL, command, &security, &security, security.bInheritHandle,
dwCreateFlags, env, cwd, &startup, &process)) { return NULL;
Could you explain this change? It seems to change the semantics of popen in a significant way...
--
Garrett Serack | Open Source Software Developer | Microsoft Corporation
Office:(425)706-7939
email/messenger: garretts@microsoft.com
blog: http://fearthecowboy.com