-
Notifications
You must be signed in to change notification settings - Fork 244
Remove env variables that don't exist from the converted commands in Windows. #149
Remove env variables that don't exist from the converted commands in Windows. #149
Conversation
… since those have a different behaviour in Windows.
Codecov Report
@@ Coverage Diff @@
## master #149 +/- ##
=====================================
Coverage 100% 100%
=====================================
Files 3 3
Lines 54 57 +3
Branches 11 13 +2
=====================================
+ Hits 54 57 +3
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks great to me. Thank you @DanReyLop!
Let's get another maintainer to review this 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me. :)
Codecov Report
@@ Coverage Diff @@
## master #149 +/- ##
=====================================
Coverage 100% 100%
=====================================
Files 3 3
Lines 54 57 +3
Branches 11 13 +2
=====================================
+ Hits 54 57 +3
Continue to review full report at Codecov.
|
…mmands in Windows with undefined env variables Fixes #16452 Closes #19084 The latest version of `cross-env` (`5.1.1`) includes a fix to #16452. The fix is: kentcdodds/cross-env#149 Now the behaviour of commands like `cross-env node $UNDEFINED_VAR index.js` is expanding the variable to the empty string, both in Windows and in UNIX. To get the new version of `cross-env` working, I had to change all `cross-env` commands to `cross-env-shell`, as this was a breaking change on `cross-env@5`. To test: run `npm start` on a Windows `cmd.exe` shell, check that it works. cc/ @Viper007Bond @withinboredom
…ommands in Windows with undefined env variables Fixes #16452 Closes #19084 The latest version of `cross-env` (`5.1.1`) includes a fix to #16452. The fix is: kentcdodds/cross-env#149 Now the behaviour of commands like `cross-env node $UNDEFINED_VAR index.js` is expanding the variable to the empty string, both in Windows and in UNIX. To get the new version of `cross-env` working, I had to change all `cross-env` commands to `cross-env-shell`, as this was a breaking change on `cross-env@5`. To test: run `npm start` on a Windows `cmd.exe` shell, check that it works. cc/ @Viper007Bond @withinboredom
…ommands in Windows with undefined env variables Fixes #16452 Closes #19084 The latest version of `cross-env` (`5.1.1`) includes a fix to #16452. The fix is: kentcdodds/cross-env#149 Now the behaviour of commands like `cross-env node $UNDEFINED_VAR index.js` is expanding the variable to the empty string, both in Windows and in UNIX. To get the new version of `cross-env` working, I had to change all `cross-env` commands to `cross-env-shell`, as this was a breaking change on `cross-env@5`. To test: run `npm start` on a Windows `cmd.exe` shell, check that it works. cc/ @Viper007Bond @withinboredom
…ommands in Windows with undefined env variables Fixes #16452 Closes #19084 The latest version of `cross-env` (`5.1.1`) includes a fix to #16452. The fix is: kentcdodds/cross-env#149 Now the behaviour of commands like `cross-env node $UNDEFINED_VAR index.js` is expanding the variable to the empty string, both in Windows and in UNIX. To get the new version of `cross-env` working, I had to change all `cross-env` commands to `cross-env-shell`, as this was a breaking change on `cross-env@5`. To test: run `npm start` on a Windows `cmd.exe` shell, check that it works. cc/ @Viper007Bond @withinboredom
Fixes #145, check it for more context.
What: Remove env variables that don't exist from the converted commands in Windows.
Why: In Windows, if a
%variable%
is not defined (or it's the empty string), the shell won't parse it, and instead it will interpret it as the literal%variable%
string. In UNIX, an undefined or empty variable wuld be interpreted as an empty string.How: The entire
process.env
map that would be passed down to the child process is now also passed to thecommandConvert
function. While converting a env variable to the Windows format ($var => %var%
), it's checked if it actually has any value, and if it isn't, it's ommitted entirely.Checklist:
N/A