You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ls -l alink output: alink -> nonexists, showing that alink is not cleaned.
Note that broken symlinks could show up easily when cleaning a dir containing symlinks: if a link target was removed before the link is tried to remove, the link becomes broken.
Root cause: clean() in tasks/clean.js tests a filepath with grunt.file.exists() before trying to remove it, but grunt.file.exists() return false for a broken symbolic link (because of fs.exists() it calling), so clean() skips to remove it.
Possible solution: replace grunt.file.exists() with a fs.lstatSync() based solution, because it doesn't follow links. Additionally, grunt.file.isPathInCwd() also suffers from broken-symbolic-link problem.
The text was updated successfully, but these errors were encountered:
antonionoca
added a commit
to antonionoca/grunt-contrib-clean
that referenced
this issue
Oct 14, 2017
Steps to reproduce:
ln -s nonexists alink
.nonexists
is a non-existing file.cleanBrokenLink: ['alink']
and run it. The output should be:ls -l alink
output:alink -> nonexists
, showing thatalink
is not cleaned.Note that broken symlinks could show up easily when cleaning a dir containing symlinks: if a link target was removed before the link is tried to remove, the link becomes broken.
Root cause:
clean()
intasks/clean.js
tests a filepath withgrunt.file.exists()
before trying to remove it, butgrunt.file.exists()
returnfalse
for a broken symbolic link (because offs.exists()
it calling), soclean()
skips to remove it.Possible solution: replace
grunt.file.exists()
with afs.lstatSync()
based solution, because it doesn't follow links. Additionally,grunt.file.isPathInCwd()
also suffers from broken-symbolic-link problem.The text was updated successfully, but these errors were encountered: