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: follow cwd symlink on windows #410

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

mukaschultze
Copy link

Node's process.cwd() has different behaviour between unix OS's and Windows when the cwd is inside a symlink. This PR fixes this inconsistency by calling node's fs.realpathSync to follow the directory symlink and simulate unix's behaviour on Windows.

This incosistency causes patch-package to fail on Windows when it runs on a postinstall of a workspace package since yarn (and possibly other package managers as well) use symlinks to hoist packages to the root node_modules.

This PR also fixes the path comparison on the getAppRootPath, since Windows can have both \ and / path separators.

@edusperoni
Copy link

You might want to use .replace(sep, "/") (sep comes from path and will replace whatever the separator is on that filesystem to /)

@milahu
Copy link
Contributor

milahu commented Oct 24, 2022

milahu#21 (comment)

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.

None yet

3 participants