| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
There was a problem hiding this comment.
Won't it be added twice in case of duplex?
Sorry, something went wrong.
Maybe? Probably not because destroy already checks that stream is destroyed and does not call _destroy.
|
Sorry, something went wrong.
I'm not sure I follow. How is destroy related? This happens in the constructor which is invoked for both Readable and Writable. |
Sorry, something went wrong.
destroy would be called twice on the stream (since the signal has two listeners - one for the readable and one for the writeable). |
Sorry, something went wrong.
I was more thinking about addAbortSignal being called twice through constructor. |
Sorry, something went wrong.
Yes, that's probably fine, the signal is added twice, destroys the stream twice and the second destroy is ignored. |
Sorry, something went wrong.
|
I added a test for duplex that makes sure error is called exactly once and close is called to illustrate that point e71ae8f#diff-9772e10e4bd234c2a0d41c8043e02338add0b46578d4782ffc02bcb27cfbb85cR242-R256 |
Sorry, something went wrong.
|
Can't we just make use of isDuplex and add it once? |
Sorry, something went wrong.
We can, would you prefer that? Edit: I think I prefer that too. Pushed a fix + the "ignore bad signal" logic for the construct version |
Sorry, something went wrong.
| }); | ||
| let count = 0; | ||
| duplex.on('error', common.mustCall((e) => { | ||
| assert.strictEqual(count++, 0); // Ensure not called twice |
There was a problem hiding this comment.
The mustCall already handles this doesn't it?
Sorry, something went wrong.
There was a problem hiding this comment.
@jasnell I want to make sure error is called, but not called twice - I'd need a comon.mustCallOnce or something.
Sorry, something went wrong.
There was a problem hiding this comment.
lgtm
Sorry, something went wrong.
Sorry, something went wrong.
Sorry, something went wrong.
PR-URL: #36431 Reviewed-By: Robert Nagy <ronagy@icloud.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
PR-URL: #36431 Reviewed-By: Robert Nagy <ronagy@icloud.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Notable changes:
child_process:
* (SEMVER-MINOR) add signal support to spawn (Benjamin Gruenbaum) #36432
doc:
* add PoojaDurgad to collaborators (Pooja D P) #36511
lib:
* (SEMVER-MINOR) support BigInt in querystring.stringify (raisinten) #36499
src:
* (SEMVER-MINOR) add way to get IsolateData and allocator from Environment (Anna Henningsen) #36441
* (SEMVER-MINOR) allow preventing SetPrepareStackTraceCallback (Shelley Vohr) #36447
stream:
* (SEMVER-MINOR) support abortsignal in constructor (Benjamin Gruenbaum) #36431
PR-URL: #36597
Notable changes:
child_process:
* (SEMVER-MINOR) add signal support to spawn (Benjamin Gruenbaum) #36432
doc:
* add PoojaDurgad to collaborators (Pooja D P) #36511
lib:
* (SEMVER-MINOR) support BigInt in querystring.stringify (raisinten) #36499
src:
* (SEMVER-MINOR) add way to get IsolateData and allocator from Environment (Anna Henningsen) #36441
* (SEMVER-MINOR) allow preventing SetPrepareStackTraceCallback (Shelley Vohr) #36447
stream:
* (SEMVER-MINOR) support abortsignal in constructor (Benjamin Gruenbaum) #36431
PR-URL: #36597
Notable changes:
child_process:
* (SEMVER-MINOR) add signal support to spawn (Benjamin Gruenbaum) #36432
doc:
* add PoojaDurgad to collaborators (Pooja D P) #36511
lib:
* (SEMVER-MINOR) support BigInt in querystring.stringify (raisinten) #36499
src:
* (SEMVER-MINOR) add way to get IsolateData and allocator from Environment (Anna Henningsen) #36441
* (SEMVER-MINOR) allow preventing SetPrepareStackTraceCallback (Shelley Vohr) #36447
stream:
* (SEMVER-MINOR) support abortsignal in constructor (Benjamin Gruenbaum) #36431
PR-URL: #36597
| Back | FazBrowse Home | New Git URL |
As requested by @ronag (I agree it's useful especially when subclassing streams) - an API to pass AbortSignal directly to the readable/writeable constructor + tests.
It uses addAbortSignal internally to make maintenance easier.
Checklist