var elapsed = Date.now();
var timer;
var done = function() {
- clearTimeout(timer);
- done = function() {};
+ reset();
elapsed = Date.now() - elapsed;
if (elapsed > task.limit) {
throw new Error("Timed out: " + elapsed + "ms > " + task.limit + "ms");
}, limit);
};
task.timeout(task.limit);
+ process.on("uncaughtException", raise);
task.call(task, done);
} else {
task.timeout = config.timeout;
}
function raise(err) {
- clearTimeout(timer);
- done = function() {};
+ reset();
task.titles.error = err;
errors.push(task.titles);
log_titles(console.log, task.titles, red('\u00D7 '));
process.nextTick(run);
}
+
+ function reset() {
+ clearTimeout(timer);
+ done = function() {};
+ process.removeListener("uncaughtException", raise);
+ }
});