sindresorhus/gulp-chmod

Fail to chmod 777 on Windows

Closed this issue · 4 comments

Hello !

I am having trouble trying to set chmod to 777 on a tree.
Here is what I do :

pipes.allPermissionsAllowedOnDist = function() {
    return gulp.src(paths.dist + "**/*")
        .pipe(print())
        .pipe(pipes.allPermissionsAllowed());
};

gulp.task("allow-all-test", pipes.allPermissionsAllowedOnDistDev);

For indication what I am currently trying to do is to lock my dist folders (and all the files in it) for avoiding to modify dist files instead of app files by error. This part is working and I set a chmod 555 on all the files.
But when gulp watch is active and try to reload files, I have a permission error as gulp is trying to modify read-and-execute-only files. So I decided to use the above function specifically for gulp watch to allow modifcation when a file is reloaded.
But this part is not working, the print line indicate that tree is correctly browsed but file are still locked after execution.

Any idea ?
Thanks !

Ok I read again the code and understood that the mode was parsed as octal.
It seems to me that this example could introduce confusion:

var gulp = require('gulp');
var chmod = require('gulp-chmod');

gulp.task('default', function () {
    return gulp.src('src/app.js')
        .pipe(chmod(755))
        .pipe(gulp.dest('dist'));
});

Not sure what you think is confusing, but would love a PR to improve it ;)

Thanks for your answer, actually I was thinking that 0777 was different than 777 in octal but realized that it is exactly the same.
For my problem, I got it, I was trying to change the chmod of the files but not moving them after with gulp.dest. So gulp-chmod was just changing the chmod in the virutal tree.

So here is my new question, is there a way to browse the real tree and change the chmod whithout having to do a gulp.dest after ?
(I know wrench is doing something like that but it doesn't notify the end of the stream correctly so I get EPERM errors)

Thanks in advance.

kevva commented

I don't think that's possible since you're editing the files in memory.