- revert fix for #43327, it breaks system&co functions

This commit is contained in:
Pierre Joye 2009-08-20 09:03:19 +00:00
parent 52d37429c6
commit e9e5eba74b

View File

@ -313,6 +313,7 @@ TSRM_API FILE *popen_ex(const char *command, const char *type, const char *cwd,
HANDLE in, out;
DWORD dwCreateFlags = 0;
process_pair *proc;
char *cmd;
TSRMLS_FETCH();
security.nLength = sizeof(SECURITY_ATTRIBUTES);
@ -349,9 +350,13 @@ TSRM_API FILE *popen_ex(const char *command, const char *type, const char *cwd,
dwCreateFlags |= CREATE_NO_WINDOW;
}
if (!CreateProcess(NULL, command, &security, &security, security.bInheritHandle, dwCreateFlags, env, cwd, &startup, &process)) {
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)) {
return NULL;
}
free(cmd);
CloseHandle(process.hThread);
proc = process_get(NULL TSRMLS_CC);