diff --git a/lib/internal/streams/writable.js b/lib/internal/streams/writable.js index 17fc7bbbbf5b65..e55ddc1796cf6c 100644 --- a/lib/internal/streams/writable.js +++ b/lib/internal/streams/writable.js @@ -1105,7 +1105,7 @@ Writable.prototype.destroy = function(err, cb) { const state = this._writableState; // Invoke pending callbacks. - if ((state[kState] & (kBuffered | kOnFinished | kDestroyed)) !== kDestroyed) { + if ((state[kState] & (kBuffered | kOnFinished)) !== 0 && (state[kState] & kDestroyed) === 0) { process.nextTick(errorBuffer, state); }