Closes GH-687 Don't read fs read stream if not open

This commit is contained in:
isaacs 2011-02-17 17:38:36 -08:00 committed by Ryan Dahl
parent 1efac74958
commit 8b9dbdad27
2 changed files with 8 additions and 0 deletions

View File

@ -921,6 +921,9 @@ ReadStream.prototype.resume = function() {
this.buffer = null;
}
// hasn't opened yet.
if (null == this.fd) return;
this._read();
};

View File

@ -119,3 +119,8 @@ stream.on('data', function(chunk) {
stream.on('end', function() {
assert.equal('x', stream.data);
});
// pause and then resume immediately.
var pauseRes = fs.createReadStream(rangeFile);
pauseRes.pause();
pauseRes.resume();