-1
我试图运行jekyll build
作为gulp文件中的节点子进程。问题是,jekyll build
似乎正在运行多次,并从未关闭。作为节点子进程运行时Jekyll构建不关闭
我能想到的唯一可能是jekyll build
进程修改降价文件,这将导致gulp.watch
再次运行。我没有看到这方面的任何证据。
如果我只是从终端运行jekyll build
我得到这个:
Configuration file: /home/user_name/projects/project_name/_config.yml
Source: /home/user_name/projects/project_name
Destination: /home/user_name/projects/project_name/_site
Generating...
done.
Auto-regeneration: disabled. Use --watch to enable.
当我运行它作为一个子节点过程中,我得到这个:
[20:59:03] Configuration file: /home/user_name/projects/project_name/_config.yml
Source: /home/user_name/projects/project_name
Destination: /home/user_name/projects/project_name/_site
Generating...
[20:59:03] Configuration file: /home/user_name/projects/project_name/_config.yml
Source: /home/user_name/projects/project_name
Destination: /home/user_name/projects/project_name/_site
Generating...
[20:59:03] Configuration file: /home/user_name/projects/project_name/_config.yml
Source: /home/user_name/projects/project_name
Destination: /home/user_name/projects/project_name/_site
Generating...
它不断重复这样的20+然后停止并在此之后不输出任何内容。
这里是我的gulpfile.js:
var gulp = require('gulp');
var spawn = require('child_process').spawn;
var gutil = require('gulp-util');
gulp.task('default', function() {
gulp.watch('**/*.md', function (e) {
var cp = spawn('jekyll', ['build']),
stdout = '',
stderr = '';
cp.stdout.setEncoding('utf8');
cp.stdout.on('data', function (data) {
stdout += data;
gutil.log(data);
});
cp.stderr.setEncoding('utf8');
cp.stderr.on('data', function (data) {
stderr += data;
gutil.log(gutil.colors.red(data));
});
cp.on('error', function (err) {
gutil.log(gutil.colors.red('gulp-jekyll', err));
});
cp.on('close', function (code) {
gutil.log('Done with exit code ', code);
gutil.log('Jekyll has completed the build process.');
});
});
});