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 #946
  • Loading branch information
pkozlowski-opensource committed May 8, 2014
1 parent 70a07f5 commit bd66274
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 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 @@ -110,6 +110,10 @@ var ProcessLauncher = function(spawn, tempDir, timer) {
}

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

Expand Down

0 comments on commit bd66274

Please sign in to comment.