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

Fix yarn create command on Windows #3848

Merged
merged 1 commit into from
Jul 9, 2017
Merged

Conversation

Volune
Copy link
Contributor

@Volune Volune commented Jul 7, 2017

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.

@@ -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);
Copy link
Member

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)

Copy link
Contributor Author

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.

Copy link
Member

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 😞

Copy link
Contributor Author

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)?

@arcanis arcanis self-assigned this Jul 7, 2017
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

Successfully merging this pull request may close these issues.

2 participants