Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Nagy <ronagy@icloud.com>2019-08-19 00:38:35 +0300
committerRobert Nagy <ronagy@icloud.com>2020-02-29 11:34:43 +0300
commit311e12b96201c01d6c66c800d8cfc59ebf9bc4ae (patch)
tree948b2bd7cbea0f81334ada528c094ff9c2bcdeee /lib/internal/fs
parent8b1efe0306c4c0ed35a271cfa9ea00033b75c6c2 (diff)
stream: fix multiple destroy calls
Previously destroy could be called multiple times causing inconsistent and hard to predict behavior. Furthermore, since the stream _destroy implementation can only be called once, the behavior of applying destroy multiple times becomes unclear. This changes so that only the first destroy() call is executed and any subsequent calls are noops. PR-URL: https://github.com/nodejs/node/pull/29197 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
Diffstat (limited to 'lib/internal/fs')
-rw-r--r--lib/internal/fs/streams.js2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/internal/fs/streams.js b/lib/internal/fs/streams.js
index 5b37dca74be..a76a8f6895c 100644
--- a/lib/internal/fs/streams.js
+++ b/lib/internal/fs/streams.js
@@ -458,7 +458,7 @@ WriteStream.prototype._writev = function(data, cb) {
if (er) {
if (this.autoClose) {
- this.destroy();
+ this.destroy(er);
}
return cb(er);
}