-
-
Notifications
You must be signed in to change notification settings - Fork 68
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Does this work on windows? #238
Comments
I am using env-cmd to run chromatic with the token defined in a .env file in the packages directory and it works without issues on my Windows 10 machine. Maybe a detailed error could help pinpoint the problem? |
On windows 10, running this: env-cmd -x nr gatsby develop --verbose --port \$APP_PORT --host 0.0.0.0 should output: env-cmd -x nr gatsby develop --verbose --port 9000 --host 0.0.0.0 but I get: env-cmd -x nr gatsby develop --verbose --port \\$APP_PORT --host 0.0.0.0 I think |
Simply doing: "start": "env-cmd -x nr gatsby develop --verbose --port $APP_PORT --host 0.0.0.0", with no There is something funny going on with \ on Windows and powershell |
Simpler test:
With verbose flag:
|
Potential fix for Windows, since diff --git a/node_modules/env-cmd/dist/expand-envs.js b/node_modules/env-cmd/dist/expand-envs.js
index b46324a..576a651 100644
--- a/node_modules/env-cmd/dist/expand-envs.js
+++ b/node_modules/env-cmd/dist/expand-envs.js
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
* the environment variable doesn't exist, it leaves it as is.
*/
function expandEnvs(str, envs) {
- return str.replace(/(?<!\\)\$[a-zA-Z0-9_]+/g, varName => {
+ return str.replace('\\$', '$').replace(/(?<!\\)\$[a-zA-Z0-9_]+/g, varName => {
const varValue = envs[varName.slice(1)];
return varValue === undefined ? varName : varValue;
});
Let me know if this makes sense, I could open a PR |
if you want to add windows to your actions: jobs:
build-test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest]
steps:
- name: Checkout
uses: actions/checkout@v2 |
Thanks for the patch @phil-lgr |
I tried the basic example in the README and cant get it to run on Windows 10. Does this support Windows?
The text was updated successfully, but these errors were encountered: