Skip to content

Commit

Permalink
check pause status before resuming
Browse files Browse the repository at this point in the history
  • Loading branch information
James Halliday committed May 4, 2013
1 parent bd9e9a6 commit 606b141
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
9 changes: 8 additions & 1 deletion index.js
Expand Up @@ -81,7 +81,14 @@ function createHarness (conf_) {

test.createStream = function () {
if (!results) results = createResultStream();
nextTick(function () { results.resume() });

var _pause = results.pause;
var paused = false;
results.pause = function () { paused = true };

nextTick(function () {
if (!paused) results.resume();
});
return results;
};

Expand Down
2 changes: 1 addition & 1 deletion lib/results.js
Expand Up @@ -115,7 +115,7 @@ Results.prototype.push = function (t, parentT) {

Results.prototype.close = function () {
var self = this;
if (self.closed) self.stream.emit('error', new Error('ALREADY CLOSED'));
if (self.closed) self.stream.emit('error', new Error('ALREADY CLOSED'));
self.closed = true;
var write = function (s) { self.stream.queue(s) };

Expand Down

0 comments on commit 606b141

Please sign in to comment.