Always guard leaking env variables on Windows with SETLOCAL/ENDOCAL

Windows-only
This commit is contained in:
Slava Kim
2015-03-09 12:05:02 -07:00
parent 4bab8566fd
commit eb33978b60
3 changed files with 12 additions and 5 deletions

View File

@@ -1,5 +1,6 @@
@echo off
SETLOCAL
rem only if we are running from a checkout
IF EXIST "%~dp0\.git" (
rem verify that we have 7zip in the path
@@ -37,4 +38,5 @@ IF EXIST "%~dp0\.git" (
SET NODE_PATH=%~dp0\dev_bundle\lib\node_modules
"%~dp0\dev_bundle\bin\node.exe" "%~dp0\tools\main.js" %*
ENDLOCAL

View File

@@ -1185,11 +1185,13 @@ files._generateScriptLinkToMeteorScript = function (scriptLocation) {
var newScript = [
"@echo off",
"set METEOR_INSTALLATION=%~dp0%",
"SETLOCAL",
"SET METEOR_INSTALLATION=%~dp0%",
// always convert to Windows path since this function can also be
// called on Linux or Mac when we are building bootstrap tarballs
"\"" + scriptLocationConverted + "\" %*",
"ENDLOCAL",
// add a comment with the destination of the link, so it can be read later
// by files.readLinkToMeteorScript
"rem " + scriptLocationConverted,

View File

@@ -1,10 +1,13 @@
REM Find the top of the tools tree (not to be confused with the 'tools'
REM directory in that tree)
set TOOLS_DIR="%~dp0\..\..\.."
SETLOCAL
SET TOOLS_DIR="%~dp0\..\..\.."
REM Find our binary dependencies (node).
set DEV_BUNDLE="%TOOLS_DIR%\dev_bundle"
SET DEV_BUNDLE="%TOOLS_DIR%\dev_bundle"
REM Have at it!
set NODE_PATH="%DEV_BUNDLE%\lib\node_modules"
"%DEV_BUNDLE%\bin\node" "%~dp0\fake-mongod.js" %*
SET NODE_PATH="%DEV_BUNDLE%\lib\node_modules"
"%DEV_BUNDLE%\bin\node" "%~dp0\fake-mongod.js" %*
ENDLOCAL