-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Fix executing scripts with spaces #809
Conversation
Hi @ticky! Nice to see another Melburnian contributing to Yarn. I'm from Melbourne too 😄 For your test plan, I think it'd be good to include some examples of scripts that you tested with Maybe something like this: {
"name": "yarntest_issue733",
"version": "1.0.0",
"devDependencies": {
"jest": "^16.0.1"
},
"scripts": {
"first": "node foo.js",
"second": "jest __tests__/hello-test.js"
}
} Both This is mainly so we can keep track of the test plan, and other people can re-test the exact same scenarios in the future if they're going to change the same code. I suspect this will fix #735 too. |
Just don’t tell anyone I actually started out in Perth 😜 I didn’t see anywhere in the existing test suite where this kind of CLI interop was tested, so I figured I’d leave adding such a thing to the repo proper for another intrepid soul. Yarn does not currently run any executables on the system path; only executables within To that end, and given the current behaviour, I’ve updated the test scenarios in the PR description. |
I'm adding tests for this in #821. I can't complete the tests right now because master is broken. If we can merge this I can continue with the tests. |
@AlicanC if you take a look at the newly updated PR comment, it should lead you to six good test scenarios for this! 😄 I can’t really comment on how the test hooks in, as I’m not that familiar with this application of async stuff! |
The current build failure seems to be a flaky test 😉 |
Is running scripts with |
Yarn puts executables in the same place npm is expecting them, so it works fine |
i hope this will be merged soon as it effectively resolve this issue. Good job |
Thank you so much! |
@kittens Any ETA on a patch release that has this fix, or a way to workaround until then? (looks like there is a bunch of folks depending on this fix) Thanks for the amazing work on yarn btw :) |
@lfittl I've just been using |
If you like, you can clone the Yarn repository and build it to get all the latest bugfixes. Something like this should be sufficient on Linux (or Mac OS):
Then add |
probably bc of yarnpkg/yarn#809 so we'll run the npm scripts with npm for now
@Daniel15 |
When does this version get pushed as the latest release so I can get it with |
Currently having the same issue attempting to execute run script with yarn on Mac OS and Unix on CI. Do we know if this fix would be released as part of |
Having the same problem and posted a question about it. Looks like we just have to wait. |
Just wanted to note that I don't see this issue when I install yarn via |
Thx @icd2k3, uninstalled yarn 0.15.1 (previously npm installed) and used the bash installer... |
Still hitting this issue on my osx.
Thanks @icd2k3 , it works! |
Anyone have a rough ETA on when this will be released? |
Anyone interested, please see #1156 for a work-around. |
Summary
The script quoting behaviour introduced in #663 breaks package.json script entries with spaces in them on Unix.
Instead, this quotes
node_modules/.bin
executable paths, which makes sure both package.json script entries, and executables can be called.Test plan
For this package.json;
with dependencies installed,
~/yarntest_pr809
);yarn run test -- --help
should print jest’s help message on the current release, and with this patch.yarn run test-help
will fail on the current release, and print jest’s help message with this patch.yarn run jest -- --help
will print jest’s help message on both the current release and with this patch.~/yarn test pr809
);yarn run test --help
should print jest’s help message on the current release, and with this patch.yarn run test-help
will fail on the current release, and work fine with this patch.yarn run jest -- --help
will print jest’s help message on both the current release and with this patch.Note that the use of a help flag within a script is a contrived example, but triggers the incorrect behaviour in this case.
fixes #727, #733, #735 😄