File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Open diff view settings
Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Open diff view settings
Original file line number Diff line number Diff line change @@ -42,6 +42,7 @@ const {
4242 StringPrototypeIncludes,
4343 StringPrototypeSlice,
4444 StringPrototypeToUpperCase,
45+ SymbolDispose,
4546} = primordials ;
4647
4748const {
@@ -95,6 +96,7 @@ const {
9596const MAX_BUFFER = 1024 * 1024 ;
9697
9798const isZOS = process . platform === 'os390' ;
99+ let addAbortListener ;
98100
99101/**
100102 * Spawns a new Node.js process + fork.
@@ -781,9 +783,9 @@ function spawn(file, args, options) {
781783 if ( signal . aborted ) {
782784 process . nextTick ( onAbortListener ) ;
783785 } else {
784- signal . addEventListener ( 'abort' , onAbortListener , { once : true } ) ;
785- child . once ( 'exit' ,
786- ( ) => signal . removeEventListener ( 'abort ', onAbortListener ) ) ;
786+ addAbortListener ??= require ( 'events' ) . addAbortListener ;
787+ const disposable = addAbortListener ( signal , onAbortListener ) ;
788+ child . once ( 'exit ', disposable [ SymbolDispose ] ) ;
787789 }
788790
789791 function onAbortListener ( ) {
You can’t perform that action at this time.
0 commit comments