Closed jamkitGO closed 1 year ago
Weird. Does lstat say it's a directory rather than a symbolic link? Maybe should return to the "try unlink, rmdir on EISDIR"? That fails on sunos though, where it's sometimes possible to unlink a directory and then bad stuff happens.
Yes, I test again to confirm that it's symbolic link, and its real file is deleted. Sorry that I am poor in OS, so I can't offer you a suggestion, I just find what happen. If you confirm that, the easy way is to write it into README.md
so people can notice that.
I haven't been able to reproduce this on Windows. Some additional details will be needed:
rimraf
?node -p "st=require('fs').lstatSync(process.argv[2]);[st,st.isSymbolicLink()]" <symbolic link from step 1>
ls -laF <symbolic link from step 1>
node -p "require('fs').readlinkSync(process.argv[2])" <symbolic link from step 1>
What happen: I found many people will use this lib to delete the files
node_modules
, so am I, it's helpful. But I found that in Windows, it will delete the symlink (usually created bynpm link
) innode_modules
. And What it actually do is deleted the real file (symlink's real file) too.Maybe it's our fault to use
rimraf
in that way, but it's dangerous (my symlink's real repository is deleted, which is unpushed 😢 ).Expected: Maybe give some warning?