summaryrefslogtreecommitdiff
path: root/win32
diff options
context:
space:
mode:
authorJan Dubois <jand@activestate.com>2000-12-26 12:57:31 -0800
committerJarkko Hietaniemi <jhi@iki.fi>2000-12-28 22:07:11 +0000
commit33005217ba51d2bf59b6e5a482ff80b758900633 (patch)
treed748e2b79f9564c098bc4a7d2109eedb6a1dfc2c /win32
parentd804643f1d3e26c9c696bb1ebe8344dd5f1c8f6d (diff)
downloadperl-33005217ba51d2bf59b6e5a482ff80b758900633.tar.gz
Win32::Spawn() didn't inherit cwd and env correctly
Message-ID: <reti4ts0php3anruv0qcjru3tl850g3sfd@4ax.com> p4raw-id: //depot/perl@8235
Diffstat (limited to 'win32')
-rw-r--r--win32/win32.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/win32/win32.c b/win32/win32.c
index 924ee92a7e..ba445a488b 100644
--- a/win32/win32.c
+++ b/win32/win32.c
@@ -3868,6 +3868,8 @@ XS(w32_Spawn)
{
dXSARGS;
char *cmd, *args;
+ void *env;
+ char *dir;
PROCESS_INFORMATION stProcInfo;
STARTUPINFO stStartInfo;
BOOL bSuccess = FALSE;
@@ -3878,6 +3880,9 @@ XS(w32_Spawn)
cmd = SvPV_nolen(ST(0));
args = SvPV_nolen(ST(1));
+ env = PerlEnv_get_childenv();
+ dir = PerlEnv_get_childdir();
+
memset(&stStartInfo, 0, sizeof(stStartInfo)); /* Clear the block */
stStartInfo.cb = sizeof(stStartInfo); /* Set the structure size */
stStartInfo.dwFlags = STARTF_USESHOWWINDOW; /* Enable wShowWindow control */
@@ -3890,8 +3895,8 @@ XS(w32_Spawn)
NULL, /* Default thread security */
FALSE, /* Must be TRUE to use std handles */
NORMAL_PRIORITY_CLASS, /* No special scheduling */
- NULL, /* Inherit our environment block */
- NULL, /* Inherit our currrent directory */
+ env, /* Inherit our environment block */
+ dir, /* Inherit our currrent directory */
&stStartInfo, /* -> Startup info */
&stProcInfo)) /* <- Process info (if OK) */
{
@@ -3902,6 +3907,8 @@ XS(w32_Spawn)
CloseHandle(stProcInfo.hThread);/* library source code does this. */
bSuccess = TRUE;
}
+ PerlEnv_free_childenv(env);
+ PerlEnv_free_childdir(dir);
XSRETURN_IV(bSuccess);
}