-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.');
});
});
});