Skip to content

Commit

Permalink
fix close bug
Browse files Browse the repository at this point in the history
  • Loading branch information
Raynos committed Jan 19, 2013
1 parent ad90739 commit bd1db4e
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ function createHarness (conf_) {
var count = 0;

var began = false;
var closed = false;
var out = new Render();

var test = function (name, conf, cb) {
Expand All @@ -36,6 +37,10 @@ function createHarness (conf_) {
if (conf.exit !== false) {
onexit(function (code) {
t._exit();
if (!closed) {
closed = true
out.close();
}
if (!code && !t._ok) process.exit(1);
});
}
Expand Down Expand Up @@ -83,7 +88,8 @@ function createHarness (conf_) {
process.nextTick(function () {
running = false;
if (pending.length) return pending.shift()();
if (count === 0) {
if (count === 0 && !closed) {
closed = true
out.close();
}
if (conf.exit !== false && canExit && !t._ok) {
Expand Down

0 comments on commit bd1db4e

Please sign in to comment.