任务“彼此阻塞”
问题描述:
我在Grunt中发现了一个奇怪的行为,它似乎是两个任务彼此阻塞(或类似的东西)。任务是:shell(https://github.com/sindresorhus/grunt-shell)和sass(https://github.com/gruntjs/grunt-contrib-sass)。任务“彼此阻塞”
My(reduced)Gruntfile;
"use strict";
var path = require('path');
module.exports = function(grunt) {
require('time-grunt')(grunt);
require('load-grunt-tasks')(grunt);
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
shell: {
options: {
stdout: true,
stderr: true
},
bower: {
command: path.resolve(process.cwd() + '/node_modules/.bin/bower --allow-root install')
}
},
/* ... other tasks */
sass: {
dist: {
options: {
trace: true
},
files: {
'dist/additional.css': 'assets/stylesheets/additional.scss'
}
}
}
});
grunt.registerTask('default', [
'shell',
'sass',
]);
}
当我开始我的grunt
外壳任务完成,但咕噜“停止”的壳任务:
Running "shell:bower" (shell) task
Running "sass:dist" (sass) task
### ctrl + C###
Execution Time (2015-04-06 10:56:14 UTC)
loading tasks 8.9s █ 1%
shell:bower 18.6s ██ 2%
sass:dist 13m 25.2s ██████████████████████████████████████████████ 97%
Total 13m 52.7s
当我(分别grunt shell
grunt sass
)seperately开始这些工作一切正常。
任何想法?谢谢!
答
开关grunt-shell
因为它叉grunt-shell-spawn
并尝试同步运行任务。
shell: {
options: {
stdout: true,
stderr: true,
async: false
},
bower: {
command: path.resolve(process.cwd() + '/node_modules/.bin/bower --allow-root install')
}
}
你可以提供你的package.json上列出的依赖吗? – Rigotti 2015-04-06 13:46:29
查看https://gist.github.com/nehalist/bc0eb3fb5139c495fb46 – nehalist 2015-04-06 14:15:39