-
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 yarn create
command on Windows
#3848
Conversation
src/cli/commands/create.js
Outdated
@@ -51,7 +52,10 @@ export async function run(config: Config, reporter: Reporter, flags: Object, arg | |||
throw new MessageError(reporter.lang('createInvalidBin', packageName)); | |||
} | |||
|
|||
await child.spawn(binPath, rest, {stdio: `inherit`}); | |||
const linkedBinPath = config.getTemp(`create-bin-${packageName}`); | |||
await linkBin(binPath, linkedBinPath); |
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.
I'm not sure calling linkBin
is required, is it? It should have been done when adding the package (l30)
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.
I assumed we were previously not using the already linked bin for a reason. If there are no reasons, I can indeed change to use the existing one in global.
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.
Nope, no particular reason - I just forgot about this behavior when I implemented the feature 😞
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.
@arcanis Please review the new implementation. Tested on Windows.
Also I wonder, shouldn't we pass the flags to runGlobal
(and now also to getBinFolder
)?
Summary
Yarn create fails on Windows, see #3530
The issue is caused by Yarn trying to run a javascript file as an executable (the !# doesn't work in Windows command)
This PR uses the existing
linkBin
function to create any appropriate shim depending on the system.Test plan
No existing test. Manually tested on Windows 10 and one linux. More tests by other people would be appreciated.
Also any idea to automate a test here is welcomed.