Skip to content

Conversation

paul-soporan
Copy link
Member

What's the problem this PR addresses?

The --cwd argument is currently resolved using realpathSync.
This behavior was introduced in #373 as a workaround for a bug caused by symlinks and the recursive --cwd logic.

How did you fix it?

Removed the unnecessary realpath calls. They are no longer needed due to the removal of the recursive logic in #5600.

I've also added a few tests, I'll add the rest from #5595 in a future PR.

Checklist

  • I have set the packages that need to be released for my changes to be effective.
  • I will check that all automated PR checks pass before the PR gets reviewed.

} else if (argv.length >= 1 && argv[0].startsWith(`--cwd=`)) {
cwd = npath.toPortablePath(argv[0].slice(6));
postCwdArgv = argv.slice(1);
}

cli.defaultContext.cwd = cwd ?? ppath.cwd();
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You removed the resolve calls, which are important because everything breaks if this.context.cwd isn't an absolute path.

Suggested change
cli.defaultContext.cwd = cwd ?? ppath.cwd();
cli.defaultContext.cwd = ppath.resolve(cwd) ?? ppath.cwd();

@arcanis arcanis merged commit d9c0747 into master Jul 28, 2023
@arcanis arcanis deleted the paul/perf/remove-realpath branch July 28, 2023 20:53
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