gulp chown doesn't change owner -
i trying make build process, sort of, , seems gulp-chown doesn't give me correct results.
this run:
gulp.task('clientdeploy', function () { return gulp.src('client/dist/**/*') .pipe(chown('rf', 'rfids')) .pipe(gulp.dest('/var/www/html/dashboard')); });
the gulp script runs root, obviously.
the result this:
drwxr-xr-x 2 root root 4.0k jun 29 12:57 css/ drwxr-xr-x 2 root root 4.0k jun 29 12:57 fonts/ drwxr-xr-x 2 root root 4.0k jun 29 12:57 icons/ drwxr-xr-x 3 root root 4.0k jun 29 12:57 images/ drwxr-xr-x 2 root root 4.0k jun 29 12:57 js/ -rw-rw-r-- 1 root root 8.3k jun 29 13:15 events-panel.html -rw-r--r-- 1 root root 20k jun 29 13:15 index.html -rw-rw-r-- 1 root root 8.2k jun 29 13:15 main-panel.html
i've read here on github problem might gulp.dest() doesn't read file's metadata, , uses user runs command.
has ever come across , solved it?
it bug in vinyl-fs
. when writes file disk, honors file.stat.mode
(where file
vinyl
file
object) ignores values of file.stat.uid
, file.stat.gid
.
it looks has been fixed in code base of vinyl-fs
afaik there no release yet contains fix.
someone in bug report linked mentions having cloned gulp-chown
don't think that's necessary. change file ownership after gulp.dest
has done work:
import gulp "gulp"; import es "event-stream"; import fs "fs"; gulp.task("build", () => gulp.src("src/**/*") .pipe(gulp.dest("build")) .pipe(es.map((file, callback) => { fs.chown(file.path, file.stat.uid, file.stat.gid, (err) => callback(err, file)); })));
you see i'm using file.stat.uid
, file.stat.gid
. goal preserve ownership source file has. (yeah, because vinyl-fs
not this default.) can put uid
, gid
want there.
Comments
Post a Comment