Skip to content
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

when using cross-env-shell, the CLI args get split on whitespace #324

Open
thepuzzlemaster opened this issue Dec 5, 2021 · 0 comments
Open

Comments

@thepuzzlemaster
Copy link

version: 1.14.0
platform: OSX

repro: I have the following script in my package.json

"test:integration:start": "cross-env-shell start-server-and-test \"node server.js\" https-get://localhost:3333 \"cypress run\"",

When I run yarn test:integration:start, it always splits up node and server.js and cypress and run, so it tries to launch the server using node, and then waits for a response at server.js. I've tried every combination of escaped double quotes or single quotes I can think of to get it to read those strings together, but to no avail.

  • expected behavior
    start-server-and-test can read my strings without splitting on whitespace

  • actual behavior
    Each string is split on whitespace, leading to the script incorrectly parsing the command.

I also tried pulling out the strings into environment variables, but got the same result.
I also tried putting each command into its own npm script, and while that does actually work, it runs the commands with npm rather than yarn. If I add the yarn prefix, it splits those 2 words apart as well (e.g. starts the server using yarn and then waits for a response on myScriptName.)

I'm sure this has to do with the combination of cross-env-shell with start-server-and-test, but I'm hoping there's a way around it where i can continue to use both libraries.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant