Skip to content

Commit

Permalink
fix: Log errors in the background subprocess
Browse files Browse the repository at this point in the history
Currently there is not output if the background subprocess exits with an error,
for example because the configuration file has a syntax error. This commit fixes
that.
  • Loading branch information
mgol committed Jul 24, 2014
1 parent f60c64b commit 25fad00
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion tasks/grunt-karma.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,15 @@ module.exports = function(grunt) {

//allow karma to be run in the background so it doesn't block grunt
if (data.background){
var backgroundProcess = grunt.util.spawn({cmd: 'node', args: [path.join(__dirname, '..', 'lib', 'background.js'), JSON.stringify(data)]}, function(){});
var backgroundArgs = {
cmd: 'node',
args: [path.join(__dirname, '..', 'lib', 'background.js'), JSON.stringify(data)]
};
var backgroundProcess = grunt.util.spawn(backgroundArgs, function(error){
if (error) {
grunt.log.error(error);
}
});
process.on('exit', function () {
backgroundProcess.kill();
});
Expand Down

0 comments on commit 25fad00

Please sign in to comment.