gulp.dest hanging copying an electon built app (macoS)

37 views Asked by At

I'm using gulp to copy an Electron built app to a directory and the task appears to be hanging in mid-copy. Checking the dest directory the copy is only partially complete; some files have copied, others haven't. All the Lua files copy and the task completes if I remove the .app line in LUafiles.

My best guess is that symlinks in the .app directory structure may be giving it trouble but I can't be sure. The symlinks point to files within the .ap directory. Thoughts appreciated.

const gulp = require('gulp');
const debug = require('gulp-debug')

const Lualib = '/Users/kimaldis/Documents/Dev/lightroom dev/lib'
var Luafiles = [
    "Tak.lrdevplugin/**/*.lua",
    Lualib + "/JSON.lua",
    Lualib + "/Path.lua",
    Lualib + "/Utils.lua",
    Lualib + "/Log.lua",
    Lualib + "/class.lua",
    "TakServer/dist/mac/takserver-darwin-x64/*takserver.app/**/*"   // run npm run package-mac in root first to build server app
]
gulp.task('watch', function() {

    console.log( `watching ${Luafiles}` )

    // copy lr plugin to local plugin dir
    // copy takserver app into '<install dir>/Tak.lrdevplugin'
    gulp.watch( Luafiles, function ( cb ) {
        gulp.src( Luafiles, { } )
            .pipe(gulp.dest( `/Users/kimaldis/Lightroom/Lightroom Plugins/Tak.lrdevplugin` ))
            .pipe(debug({title: 'Copying LR Plugin to local plugin dir :'}))
            .on('error', () => {
                console.error('Error');
             })
            .on('finish', () => { 
                console.log('Success');
            });


        return cb()
    })

} )

1

There are 1 answers

0
Kim Aldis On

Returning the return value from gulp.src() fixed the hang. Adding {follow: true} to gulp.src() copied the symlinks correctly. The symlinks were resolved, no longer symlinks in the destination tree but that doesn't appear to be problematic:

    gulp.watch( Luafiles, function ( cb ) {
        return gulp.src( Luafiles, { follow: true }  )
            .pipe(gulp.dest( `/Users/kimaldis/Lightroom/Lightroom Plugins/Tak.lrdevplugin` ))
            .pipe(debug({title: 'Copying LR Plugin to local plugin dir :'}))
            .on('error', () => {
                console.error('Error');
             })
            .on('finish', () => { 
                console.log('Success');
            });


        // return cb()
    })