mirror of
https://github.com/nodejs/node.git
synced 2025-08-15 13:48:44 +02:00
readline: use addAbortListener
PR-URL: https://github.com/nodejs/node/pull/48550 Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
This commit is contained in:
parent
d96e62528e
commit
8708e6e5cb
3 changed files with 18 additions and 12 deletions
|
@ -28,6 +28,7 @@ const {
|
|||
StringPrototypeStartsWith,
|
||||
StringPrototypeTrim,
|
||||
Symbol,
|
||||
SymbolDispose,
|
||||
SymbolAsyncIterator,
|
||||
SafeStringIterator,
|
||||
} = primordials;
|
||||
|
@ -325,8 +326,8 @@ function InterfaceConstructor(input, output, completer, terminal) {
|
|||
if (signal.aborted) {
|
||||
process.nextTick(onAborted);
|
||||
} else {
|
||||
signal.addEventListener('abort', onAborted, { once: true });
|
||||
self.once('close', () => signal.removeEventListener('abort', onAborted));
|
||||
const disposable = EventEmitter.addAbortListener(signal, onAborted);
|
||||
self.once('close', disposable[SymbolDispose]);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue