| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 2ea08e9 commit 7c4f9a3
4 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -292,10 +292,14 @@ function constructNT(stream) { | |||
| 292 | 292 | then.call( | |
| 293 | 293 | result, | |
| 294 | 294 | function() { | |
| 295 | - process.nextTick(onConstruct, null); | ||
| 295 | + if (!called) { | ||
| 296 | + process.nextTick(onConstruct, null); | ||
| 297 | + } | ||
| 296 | 298 | }, | |
| 297 | 299 | function(err) { | |
| 298 | - process.nextTick(onConstruct, err); | ||
| 300 | + if (!called) { | ||
| 301 | + process.nextTick(onConstruct, err); | ||
| 302 | + } | ||
| 299 | 303 | }); | |
| 300 | 304 | } | |
| 301 | 305 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -699,10 +699,14 @@ function callFinal(stream, state) { | |||
| 699 | 699 | then.call( | |
| 700 | 700 | result, | |
| 701 | 701 | function() { | |
| 702 | - process.nextTick(onFinish, null); | ||
| 702 | + if (!called) { | ||
| 703 | + process.nextTick(onFinish, null); | ||
| 704 | + } | ||
| 703 | 705 | }, | |
| 704 | 706 | function(err) { | |
| 705 | - process.nextTick(onFinish, err); | ||
| 707 | + if (!called) { | ||
| 708 | + process.nextTick(onFinish, err); | ||
| 709 | + } | ||
| 706 | 710 | }); | |
| 707 | 711 | } | |
| 708 | 712 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -9,26 +9,6 @@ const { | |||
| 9 | 9 | const { setTimeout } = require('timers/promises'); | |
| 10 | 10 | const assert = require('assert'); | |
| 11 | 11 | ||
| 12 | - { | ||
| 13 | - class Foo extends Duplex { | ||
| 14 | - async _construct(cb) { | ||
| 15 | - // eslint-disable-next-line no-restricted-syntax | ||
| 16 | - await setTimeout(common.platformTimeout(1)); | ||
| 17 | - cb(); | ||
| 18 | - throw new Error('boom'); | ||
| 19 | - } | ||
| 20 | - } | ||
| 21 | - | ||
| 22 | - const foo = new Foo(); | ||
| 23 | - foo.on('error', common.expectsError({ | ||
| 24 | - message: 'boom' | ||
| 25 | - })); | ||
| 26 | - foo.on('close', common.mustCall(() => { | ||
| 27 | - assert(foo._writableState.constructed); | ||
| 28 | - assert(foo._readableState.constructed); | ||
| 29 | - })); | ||
| 30 | - } | ||
| 31 | - | ||
| 32 | 12 | { | |
| 33 | 13 | class Foo extends Duplex { | |
| 34 | 14 | async _destroy(err, cb) { | |
@@ -98,9 +78,7 @@ const assert = require('assert'); | |||
| 98 | 78 | ||
| 99 | 79 | const foo = new Foo(); | |
| 100 | 80 | foo.write('test', common.mustCall()); | |
| 101 | - foo.on('error', common.expectsError({ | ||
| 102 | - code: 'ERR_MULTIPLE_CALLBACK' | ||
| 103 | - })); | ||
| 81 | + foo.on('error', common.mustNotCall()); | ||
| 104 | 82 | } | |
| 105 | 83 | ||
| 106 | 84 | { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,26 @@ | |||
| 1 | + 'use strict'; | ||
| 2 | + | ||
| 3 | + const common = require('../common'); | ||
| 4 | + const { | ||
| 5 | + Duplex, | ||
| 6 | + } = require('stream'); | ||
| 7 | + const { setTimeout } = require('timers/promises'); | ||
| 8 | + | ||
| 9 | + { | ||
| 10 | + class Foo extends Duplex { | ||
| 11 | + async _final(callback) { | ||
| 12 | + // eslint-disable-next-line no-restricted-syntax | ||
| 13 | + await setTimeout(common.platformTimeout(1)); | ||
| 14 | + callback(); | ||
| 15 | + } | ||
| 16 | + | ||
| 17 | + _read() {} | ||
| 18 | + } | ||
| 19 | + | ||
| 20 | + const foo = new Foo(); | ||
| 21 | + foo._write = common.mustCall((chunk, encoding, cb) => { | ||
| 22 | + cb(); | ||
| 23 | + }); | ||
| 24 | + foo.end('test', common.mustCall()); | ||
| 25 | + foo.on('error', common.mustNotCall()); | ||
| 26 | + } | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments