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(cli): fix --cwd #1134

Merged
merged 5 commits into from
Apr 3, 2020
Merged

fix(cli): fix --cwd #1134

merged 5 commits into from
Apr 3, 2020

Conversation

paul-soporan
Copy link
Member

@paul-soporan paul-soporan commented Mar 30, 2020

What's the problem this PR addresses?

There are 2 code paths here:

if (yarnPath !== null && !ignorePath) {

The --cwd option is only checked for on the else branch, so when run is called after --cwd is encountered, there is a possibility that the if branch will execute with the --cwd option that was already encountered.

This causes commands to be executed in the wrong directory in some cases.

This PR closes #1056.

How did you fix it?

I made the --cwd flag and its argument get removed from process.argv when --cwd is encountered.

@arcanis arcanis merged commit 31268cc into yarnpkg:master Apr 3, 2020
@arcanis
Copy link
Member

arcanis commented Apr 3, 2020

🚀

@paul-soporan paul-soporan deleted the fix/cli/--cwd branch April 3, 2020 21:32
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.

[Bug] yarn breaks with relative --cwd option
2 participants