We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent ba817d3 commit 5644dd7Copy full SHA for 5644dd7
lib/fs.js
@@ -2016,7 +2016,7 @@ ReadStream.prototype.close = function(cb) {
2016
2017
if (this.closed || typeof this.fd !== 'number') {
2018
if (typeof this.fd !== 'number') {
2019
- this.once('open', this.close.bind(this, null));
+ this.once('open', closeOnOpen);
2020
return;
2021
}
2022
return process.nextTick(() => this.emit('close'));
@@ -2034,6 +2034,11 @@ ReadStream.prototype.close = function(cb) {
2034
this.fd = null;
2035
};
2036
2037
+// needed because as it will be called with arguments
2038
+// that does not match this.close() signature
2039
+function closeOnOpen(fd) {
2040
+ this.close();
2041
+}
2042
2043
fs.createWriteStream = function(path, options) {
2044
return new WriteStream(path, options);
0 commit comments