| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent d3162da commit 369f239
2 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -57,7 +57,6 @@ const { | |||
| 57 | 57 | getHighWaterMark, | |
| 58 | 58 | getDefaultHighWaterMark | |
| 59 | 59 | } = require('internal/streams/state'); | |
| 60 | - const assert = require('internal/assert'); | ||
| 61 | 60 | const { | |
| 62 | 61 | ERR_INVALID_ARG_TYPE, | |
| 63 | 62 | ERR_METHOD_NOT_IMPLEMENTED, | |
@@ -854,11 +853,9 @@ Writable.prototype.destroy = function(err, cb) { | |||
| 854 | 853 | const state = this._writableState; | |
| 855 | 854 | ||
| 856 | 855 | // Invoke pending callbacks. | |
| 857 | - if ( | ||
| 858 | - state.bufferedIndex < state.buffered.length || | ||
| 859 | - state[kOnFinished].length | ||
| 860 | - ) { | ||
| 861 | - assert(!state.destroyed); | ||
| 856 | + if (!state.destroyed && | ||
| 857 | + (state.bufferedIndex < state.buffered.length || | ||
| 858 | + state[kOnFinished].length)) { | ||
| 862 | 859 | process.nextTick(errorBuffer, state); | |
| 863 | 860 | } | |
| 864 | 861 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -460,3 +460,14 @@ const assert = require('assert'); | |||
| 460 | 460 | assert.strictEqual(write.destroyed, true); | |
| 461 | 461 | })); | |
| 462 | 462 | } | |
| 463 | + | ||
| 464 | + { | ||
| 465 | + // Destroy twice | ||
| 466 | + const write = new Writable({ | ||
| 467 | + write(chunk, enc, cb) { cb(); } | ||
| 468 | + }); | ||
| 469 | + | ||
| 470 | + write.end(common.mustCall()); | ||
| 471 | + write.destroy(); | ||
| 472 | + write.destroy(); | ||
| 473 | + } | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments