| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 4b47f89 commit b3372a8
2 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -213,7 +213,8 @@ function eos(stream, options, callback) { | |||
| 213 | 213 | } else if ( | |
| 214 | 214 | !readable && | |
| 215 | 215 | (!willEmitClose || isReadable(stream)) && | |
| 216 | - (writableFinished || isWritable(stream) === false) | ||
| 216 | + (writableFinished || isWritable(stream) === false) && | ||
| 217 | + (wState == null || wState.pendingcb === 0) | ||
| 217 | 218 | ) { | |
| 218 | 219 | process.nextTick(onclosed); | |
| 219 | 220 | } else if ( | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -669,15 +669,21 @@ testClosed((opts) => new Writable({ write() {}, ...opts })); | |||
| 669 | 669 | } | |
| 670 | 670 | ||
| 671 | 671 | { | |
| 672 | + let isCalled = false; | ||
| 672 | 673 | const stream = new Duplex({ | |
| 673 | 674 | write(chunk, enc, cb) { | |
| 674 | - setImmediate(cb); | ||
| 675 | + setImmediate(() => { | ||
| 676 | + isCalled = true; | ||
| 677 | + cb(); | ||
| 678 | + }); | ||
| 675 | 679 | } | |
| 676 | 680 | }); | |
| 677 | 681 | ||
| 678 | 682 | stream.end('foo'); | |
| 679 | 683 | ||
| 680 | 684 | finished(stream, { readable: false }, common.mustCall((err) => { | |
| 681 | 685 | assert(!err); | |
| 686 | + assert.strictEqual(isCalled, true); | ||
| 687 | + assert.strictEqual(stream._writableState.pendingcb, 0); | ||
| 682 | 688 | })); | |
| 683 | 689 | } | |
| Back | FazBrowse Home | New Git URL |
0 commit comments