@@ -37,10 +37,8 @@ const SENTINEL = 42;
3737// 3 disconnect worker with child_process's disconnect, confirm
3838// no sentinel value
3939if ( cluster . isWorker ) {
40- process . on ( 'disconnect' , function ( msg ) {
41- setTimeout ( function ( ) {
42- process . exit ( SENTINEL ) ;
43- } , 10 ) ;
40+ process . on ( 'disconnect' , ( msg ) => {
41+ setTimeout ( ( ) => process . exit ( SENTINEL ) , 10 ) ;
4442 } ) ;
4543 return ;
4644}
@@ -49,17 +47,17 @@ checkUnforced();
4947checkForced ( ) ;
5048
5149function checkUnforced ( ) {
52- cluster . fork ( )
53- . on ( 'online' , function ( ) { this . disconnect ( ) ; } )
54- . on ( 'exit' , common . mustCall ( function ( status ) {
50+ const worker = cluster . fork ( ) ;
51+ worker
52+ . on ( 'online' , common . mustCall ( ( ) => worker . disconnect ( ) ) )
53+ . on ( 'exit' , common . mustCall ( ( status ) => {
5554 assert . strictEqual ( status , SENTINEL ) ;
5655 } ) ) ;
5756}
5857
5958function checkForced ( ) {
60- cluster . fork ( )
61- . on ( 'online' , function ( ) { this . process . disconnect ( ) ; } )
62- . on ( 'exit' , common . mustCall ( function ( status ) {
63- assert . strictEqual ( status , 0 ) ;
64- } ) ) ;
59+ const worker = cluster . fork ( ) ;
60+ worker
61+ . on ( 'online' , common . mustCall ( ( ) => worker . process . disconnect ( ) ) )
62+ . on ( 'exit' , common . mustCall ( ( status ) => assert . strictEqual ( status , 0 ) ) ) ;
6563}
0 commit comments