Skip to content

Commit

Permalink
fix(launcher): cancel kill timeout when process exits cleanly
Browse files Browse the repository at this point in the history
By default browsers are killed with `process.kill()` but it might
happen that a process doesn't play nicelly and doesn't exit so
there is a timeout after which a process is SIGKILL-ed. Before
this commit the mentioned timeout wasn't cleared on clean process
exit, preventing Karma from exiting just after all tests were run.

Fixes karma-runner#946
  • Loading branch information
pkozlowski-opensource committed Apr 30, 2014
1 parent 70a07f5 commit e5c8456
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/launchers/process.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ var ProcessLauncher = function(spawn, tempDir, timer) {

onExitCallback = done;
self._process.kill();
timer.setTimeout(self._onKillTimeout, killTimeout);
self._killTimer = timer.setTimeout(self._onKillTimeout, killTimeout);
});

this._start = function(url) {
Expand Down Expand Up @@ -111,6 +111,7 @@ var ProcessLauncher = function(spawn, tempDir, timer) {

self._process = null;
self._clearTempDirAndReportDone(error);
timer.clearTimeout(self._killTimer);
};

this._clearTempDirAndReportDone = function(error) {
Expand Down

0 comments on commit e5c8456

Please sign in to comment.