function childCompleted(error, stdout, stderr) {
        log('stdout: ' + stdout);
        log('stderr: ' + stderr);
        if (error !== null) {
            log('exec error: ' + error);
        }
    }
'] : [pkg.paths.client + '/**']);
    var options = {auto: true};
    plug.livereload.listen(options);
    gulp.watch(path)
        .on('change', function(file) {
            plug.livereload.changed(file.path);
        });

    log('Serving from ' + mode);
}

function serve(args) {
    var options = {
        script: pkg.paths.server + 'app.js',
        delayTime: 1,
        ext: 'html js',
        env: {'NODE_ENV': args.mode},
        watch: [
            'gulpfile.js',
            'package.json',
            pkg.paths.server,
            pkg.paths.client
        ]
    };

    if (args.debug) {
        gulp.src('', {read: false})
            .pipe(plug.shell(['node-inspector']));
        options.nodeArgs = [args.debug + '=5858'];
    }

    if(!!env.mongo) {
        log('Starting MongoDB');
        gulp.src('', {read: false})
            .pipe(plug.shell(['/usr/local/bin/mongod --config src/server/data/mongodb.config']));
    }

    return plug.nodemon(options)
        //.on('change', tasks)
        .on('restart', function() {
            log('restarted!');
        });
}

function testCore(singleRun, done) {
    var child;
    var excludeFiles = ['./src/client/app/*