Browse Source

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

v0.7.4-release
isaacs 14 years ago
committed by Ryan Dahl
parent
commit
8b9dbdad27
  1. 3
      lib/fs.js
  2. 5
      test/simple/test-fs-read-stream.js

3
lib/fs.js

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

5
test/simple/test-fs-read-stream.js

@ -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();

Loading…
Cancel
Save