-
-
Notifications
You must be signed in to change notification settings - Fork 65
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
File has no permission entries, del returns exit code 0 / success #50
Comments
Try returning the promise in the gulp task gulp.task("delete", function() {
return del(["./deleteMe.txt"]).then(function (paths) { // returns a promise; https://github.com/sindresorhus/del
console.log("Deleted files and folders: \n", paths.join('\n'));
cb();
}, function (reason) {
cb("Failed to delete files " + reason);
});
}); |
In your case callback must be provided as a function argument (ReferenceError: cb is not defined). Actually I forgot to add cb parameter to function, thank you for notice. Still output is the same, no error. I believe there are two ways: gulp.task("delete", function() {
return del(["./deleteMe.txt"]
}); or with a callback gulp.task("delete", function(cb) {
del(["./deleteMe.txt"]).then(function (paths) {
cb(); // ok
}, function (reason) {
cb("Failed to delete files " + reason); // fail
});
}); |
Oh, didn't notice the Tested on Mac OSX 'use strict';
const gulp = require('gulp');
const del = require('del');
gulp.task('delete', () => {
return del('./deleteMe.txt');
}); output
|
Tested your code, but on Windows 10 still no error.
I'm using "del": "2.2.0" and "gulp": "3.9.0", |
@mspace Does |
@schnittstabil No, file stays on the filesystem. It does not get deleted. Permissions on the folder are set ok: full control modify, read & execute, list folder contents, read, write for currently logged-in user in this case me and some other users Administrators, .... |
Thanks for reporting it, it's a glob issue: isaacs/node-glob/issues/245 |
I can also confirm this issue on Windows 10 64-bit with node 5.5.0 and npm 3.3.12. No matter what I do I cannot delete even the simplest directory with something like:
|
That seems not related to this issue, you may try: gulp.task('clean:docs', function () {
console.log('current directory:', require('process').cwd());
console.log('files:', globby.sync(['./docs/**/*']));
return del(['./docs/**/*']);
}); |
Sorry I was still recovering this morning when I wrote that, and I must admit I was half-reading the thread trying to get in the door. When I use that function, I get:
but the files and directories remain unaffected. |
@datatypevoid If |
Sorry for my ignorance man. Thanks for your help though! |
Closing as isaacs/node-glob#245 was fixed. |
I'm using del to delete file like this (and in some cases directories *.css)
If the same task uses nodejs's fs it works, it reports error correctly:
deleteMe.txt permissions:
The text was updated successfully, but these errors were encountered: