Closed aberkovsky closed 3 years ago
Yes, this is an interesting problem. I think it's a worthwhile feature, so I'd be happy to accept a pull request for this. Would you be willing to implement that? I'm not sure we need to use path-key
because the code will literally just be: const pathKey = isWindows ? 'Path' : 'PATH'
(thanks to https://github.com/kentcdodds/cross-env/blob/master/src/is-windows.js).
Would you be interested in implementing this?
The problem was deeper...
On Windows operating systems, environment variables are case-insensitive. However, if when you spawn a new process and pass the env with two variables (PATH and Path), in this new process process.env will contains both variables, and this breaks the subsequent logic.
Npm has logic to set both Path and PATH (if exist) variables on Windows, and by default used Path on Windows. But if I use cgwin terminal on Windows for example, process.env contains PATH.
cross-env
version: 6.0.3node
version: 10.16.3npm
(oryarn
) version: 6.11.3OS
version: windows 10Relevant code or config
"test": "cross-env-shell PATH=\"../node_modules/.bin:$PATH\" echo $PATH"
What you did: Im try to add to PATH environment variable the parent .bin directory
What happened: 'echo' printed all paths, but wihtout my
Problem description: Problem in the name of 'PATH' variable in Windows envirement, it has lower case 'Path' Line below was fine "test": "cross-env-shell Path=\"../node_modules/.bin:$Path\" echo $Path"
Suggested solution: Use the 'path-key' module for PATH variable replacement.