Skip to content

Commit

Permalink
Ensure that build fails are logged at the right times
Browse files Browse the repository at this point in the history
Builds should fail with logging during the failure, not at the end. This
reverts back to the behaviour prior to yui#115.

Build fails still call the appropriate callback function.
  • Loading branch information
andrewnicols committed Apr 17, 2014
1 parent c3d2de7 commit 836a40a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
8 changes: 6 additions & 2 deletions lib/builder.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,12 @@ exports.start = function (json, options, buildCallback) {
buildStat,
end = function (err) {
var end = new Date();
log.info('done racing, the gears are toast');
log.info('finished in ' + timer.calc(start, end) + ', pretty fast huh?');
if (err) {
log.err('Build failed: Errors encountered during build');
} else {
log.info('done racing, the gears are toast');
log.info('finished in ' + timer.calc(start, end));
}
if (buildCallback) {
buildCallback(err);
}
Expand Down
10 changes: 8 additions & 2 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,16 @@ var runQueue = function() {
}
};

function standardExitCallback(err) {
if (err) {
process.exit(1);
}
}

function logAndExit(err) {
if (err) {
log.err(err);
process.exit(1);
standardExitCallback(err);
}
}

Expand All @@ -70,7 +76,7 @@ exports.init = function (opts, initCallback) {
log.reset(options);

if (!initCallback) {
initCallback = logAndExit;
initCallback = standardExitCallback;
}

if (options.cwd) {
Expand Down

0 comments on commit 836a40a

Please sign in to comment.