-
Notifications
You must be signed in to change notification settings - Fork 42
Open
Labels
Needs Triageneeds an initial reviewneeds an initial review
Description
Is there an existing issue for this?
- I have searched the existing issues
Current Behavior
The working directory changed by cd after setlocal is not maintained.
So process.cwd() returns the wrong location.
Expected Behavior
The current directory after the cd
command should be kept.
Steps To Reproduce
$HOME\AppData\Roaming\npm\aaaa.js :
console.log('CWD:', process.cwd());
$HOME\AppData\Roaming\npm\test.cmd :
@ECHO off
GOTO start
:find_dp0
SET dp0=%~dp0
EXIT /b
:start
SETLOCAL
CALL :find_dp0
IF EXIST "%dp0%\node.exe" (
SET "_prog=%dp0%\node.exe"
) ELSE (
SET "_prog=node"
SET PATHEXT=%PATHEXT:;.JS;=;%
)
endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\aaaa.js" %*
test.bat:
setlocal
cd C:\abcdefg\
test.cmd
endlocal
Run test.bat
CWD: C:\Users...\ (Other directory instead of "C:\abcdefg")
Environment
- npm: 8.12.2
- Node: v16.15.1
- OS: Windows
- platform:
Source
Line 113 in 4660668
+ 'endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & ' |
Metadata
Metadata
Assignees
Labels
Needs Triageneeds an initial reviewneeds an initial review