Skip to content

Commit

Permalink
Merge pull request #1401 from boneskull/issue/1393
Browse files Browse the repository at this point in the history
resolves #1393: kill children with more effort on SIGINT
  • Loading branch information
Travis Jeffery committed Dec 1, 2014
2 parents 5cc1415 + 95606e4 commit 92e86ad
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
7 changes: 7 additions & 0 deletions bin/mocha
Original file line number Diff line number Diff line change
Expand Up @@ -54,3 +54,10 @@ proc.on('exit', function (code, signal) {
}
});
});

// terminate children.
process.on('SIGINT', function () {
proc.kill('SIGINT'); // calls runner.abort()
proc.kill('SIGTERM'); // if that didn't work, we're probably in an infinite loop, so make it die.
process.kill(process.pid, 'SIGINT');
});
5 changes: 5 additions & 0 deletions test/acceptance/misc/exit.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,9 @@ describe('exit', function(){
console.log('all done');
}, 2500)
})

it('should kill all processes when SIGINT received', function () {
// uncomment to test
//while (true) {}
});
})

0 comments on commit 92e86ad

Please sign in to comment.