Skip to content

Commit

Permalink
When an uncaught exception is caught in watch mode, print it in the c…
Browse files Browse the repository at this point in the history
…onsole and continue watch.
  • Loading branch information
juggy authored and indexzero committed Nov 25, 2011
1 parent ddf3cf4 commit ddd9588
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions bin/vows
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,6 @@ if (args.length === 0 || options.watch) {
abort("runner", "couldn't find test folder");
}
msg('bin', 'discovered', "./" + testFolder);

if (args.length === 0) {
args = paths(testFolder).filter(function (f) {
return new(RegExp)('(-|_)' + testFolder + '.(js|coffee)$').test(f);
Expand Down Expand Up @@ -280,8 +279,7 @@ if (! options.watch) {
lastRun,
colors = ['32m', '33m', '31m'],
timer = setInterval(tick, 100);

process.on('uncaughtException', cleanup);
process.on('uncaughtException', exception);
process.on('exit', cleanup);
process.on('SIGINT', function () {
process.exit(0);
Expand Down Expand Up @@ -321,6 +319,7 @@ if (! options.watch) {
function cursorHide() { esc("?25l") }
function cursorShow() { esc("?25h") }
function cleanup() { eraseLine(), cursorShow(), clearInterval(timer), print('\n') }
function exception(err) { print(err.stack || err.message || JSON.stringify(err)), running = 0}

//
// Get a matching test for a given file
Expand Down

0 comments on commit ddd9588

Please sign in to comment.