From: Jan Dubois Date: Tue, 26 Dec 2000 20:57:31 +0000 (-0800) Subject: Win32::Spawn() didn't inherit cwd and env correctly X-Git-Tag: accepted/trunk/20130322.191538~33241 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=33005217ba51d2bf59b6e5a482ff80b758900633;p=platform%2Fupstream%2Fperl.git Win32::Spawn() didn't inherit cwd and env correctly Message-ID: p4raw-id: //depot/perl@8235 --- diff --git a/win32/win32.c b/win32/win32.c index 924ee92..ba445a4 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); }