Skip to content

Commit

Permalink
Parameterize util.exit in grunt.fail.
Browse files Browse the repository at this point in the history
  • Loading branch information
cowboy committed Jun 5, 2015
1 parent d691727 commit 7e45cb0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
2 changes: 1 addition & 1 deletion lib/grunt.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ grunt.help = require('./grunt/help');
grunt.event = require('./grunt/event');

grunt.template = require('./grunt/template').create(grunt);
grunt.fail = require('./grunt/fail').create(grunt);
grunt.fail = require('./grunt/fail').create(grunt, {exit: util.exit});
grunt.file = require('./grunt/file').create(grunt);
grunt.option = require('./grunt/option').create(grunt);
grunt.config = require('./grunt/config').create(grunt);
Expand Down
7 changes: 3 additions & 4 deletions lib/grunt/fail.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,9 @@
// Nodejs libs.
var EventEmitter = require('events').EventEmitter;

var util = require('grunt-legacy-util');
var logMethodsToEvents = require('./log-facade').logMethodsToEvents;

exports.create = function(grunt) {
exports.create = function(grunt, options) {
// The module to be exported.
var fail = {};

Expand Down Expand Up @@ -63,7 +62,7 @@ exports.create = function(grunt) {
fail.fatal = function(e, errcode) {
writeln(e, 'fatal');
dumpStack(e);
util.exit(typeof errcode === 'number' ? errcode : fail.code.FATAL_ERROR);
options.exit(typeof errcode === 'number' ? errcode : fail.code.FATAL_ERROR);
};

// Keep track of error and warning counts.
Expand All @@ -79,7 +78,7 @@ exports.create = function(grunt) {
if (!grunt.option('force')) {
dumpStack(e);
log.writeln().fail('Aborted due to warnings.');
util.exit(typeof errcode === 'number' ? errcode : fail.code.WARNING);
options.exit(typeof errcode === 'number' ? errcode : fail.code.WARNING);
}
};

Expand Down

0 comments on commit 7e45cb0

Please sign in to comment.