This repository was archived by the owner on Nov 19, 2025. It is now read-only.
Remove env variables that don't exist from the converted commands in Windows. - #149
Merged
kentcdodds merged 5 commits intoOct 27, 2017
Merged
Conversation
added 4 commits
October 22, 2017 11:01
… 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.
|
kentcdodds
approved these changes
Oct 23, 2017
kentcdodds
left a comment
Owner
There was a problem hiding this comment.
This looks great to me. Thank you @DanReyLop!
Let's get another maintainer to review this 👍
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.
|
DanReyLop
pushed a commit
to Automattic/wp-calypso
that referenced
this pull request
Oct 27, 2017
…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
DanReyLop
pushed a commit
to Automattic/wp-calypso
that referenced
this pull request
Nov 2, 2017
…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
DanReyLop
pushed a commit
to Automattic/wp-calypso
that referenced
this pull request
Nov 16, 2017
…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
DanReyLop
pushed a commit
to Automattic/wp-calypso
that referenced
this pull request
Nov 17, 2017
…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
This was referenced Sep 6, 2024
This was referenced Sep 13, 2024
This was referenced Sep 20, 2024
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.envmap that would be passed down to the child process is now also passed to thecommandConvertfunction. 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