File tree Expand file tree Collapse file tree 2 files changed +12
-2
lines changed Expand file tree Collapse file tree 2 files changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -262,14 +262,19 @@ class Worker extends EventEmitter {
262
262
} ) ;
263
263
}
264
264
265
- terminate ( callback ) {
265
+ async terminate ( callback ) {
266
266
if ( this . _exited )
267
267
return ;
268
268
269
269
if ( typeof callback === 'function' )
270
270
this . once ( 'exit' , code => callback ( null , code ) ) ;
271
271
272
272
this . _terminate ( 1 ) ;
273
+
274
+ // See: https://github.com/nodejs/node/pull/28021
275
+ return new Promise ( ( resolve ) => {
276
+ this . once ( 'exit' , resolve ) ;
277
+ } ) ;
273
278
}
274
279
275
280
unref ( ) {
Original file line number Diff line number Diff line change @@ -638,14 +638,19 @@ class Worker extends EventEmitter {
638
638
this . _exited = true ;
639
639
}
640
640
641
- terminate ( callback ) {
641
+ async terminate ( callback ) {
642
642
if ( this . _exited )
643
643
return ;
644
644
645
645
if ( typeof callback === 'function' )
646
646
this . once ( 'exit' , code => callback ( null , code ) ) ;
647
647
648
648
this . _terminate ( 1 ) ;
649
+
650
+ // See: https://github.com/nodejs/node/pull/28021
651
+ return new Promise ( ( resolve ) => {
652
+ this . once ( 'exit' , resolve ) ;
653
+ } ) ;
649
654
}
650
655
651
656
unref ( ) {
You can’t perform that action at this time.
0 commit comments