summaryrefslogtreecommitdiff
path: root/TSRM/tsrm_win32.c
diff options
context:
space:
mode:
authorShane Caraveo <shane@php.net>2002-10-29 07:32:52 +0000
committerShane Caraveo <shane@php.net>2002-10-29 07:32:52 +0000
commit1f0523c85acfeddf2b5edbf33d7eacb0dc0fc3de (patch)
treedd4afa8808a82fc416c31e17d895faf30724c13c /TSRM/tsrm_win32.c
parenta33bd0979d56372dd7155e502b57e13009566841 (diff)
downloadphp-git-1f0523c85acfeddf2b5edbf33d7eacb0dc0fc3de.tar.gz
windows is smart enough to provide a way to set cwd for new processes.
Diffstat (limited to 'TSRM/tsrm_win32.c')
-rw-r--r--TSRM/tsrm_win32.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/TSRM/tsrm_win32.c b/TSRM/tsrm_win32.c
index 691443a243..aecdec8810 100644
--- a/TSRM/tsrm_win32.c
+++ b/TSRM/tsrm_win32.c
@@ -149,6 +149,11 @@ static HANDLE dupHandle(HANDLE fh, BOOL inherit) {
TSRM_API FILE *popen(const char *command, const char *type)
{
+ return popen_ex(command, type, NULL, NULL);
+}
+
+TSRM_API FILE *popen_ex(const char *command, const char *type, const char *cwd, char *env)
+{
FILE *stream = NULL;
int fno, str_len = strlen(type), read, mode;
STARTUPINFO startup;
@@ -190,7 +195,7 @@ TSRM_API FILE *popen(const char *command, const char *type)
cmd = (char*)malloc(strlen(command)+strlen(TWG(comspec))+sizeof(" /c "));
sprintf(cmd, "%s /c %s", TWG(comspec), command);
- if (!CreateProcess(NULL, cmd, &security, &security, security.bInheritHandle, NORMAL_PRIORITY_CLASS, NULL, NULL, &startup, &process)) {
+ if (!CreateProcess(NULL, cmd, &security, &security, security.bInheritHandle, NORMAL_PRIORITY_CLASS, env, cwd, &startup, &process)) {
return NULL;
}
free(cmd);