File tree Expand file tree Collapse file tree 1 file changed +16
-12
lines changed
Expand file tree Collapse file tree 1 file changed +16
-12
lines changed Original file line number Diff line number Diff line change @@ -15,18 +15,22 @@ if (cluster.isMaster) {
1515 worker1 = cluster . fork ( ) ;
1616 worker1 . on ( 'message' , common . mustCall ( function ( ) {
1717 worker2 = cluster . fork ( ) ;
18- // make sure worker2 is listening before doing anything else
19- cluster . once ( 'listening' , function ( ) {
20- conn = net . connect ( common . PORT , common . mustCall ( function ( ) {
21- worker1 . send ( 'die' ) ;
22- worker2 . send ( 'die' ) ;
23- } ) ) ;
24- conn . on ( 'error' , function ( e ) {
25- // ECONNRESET is OK
26- if ( e . code === 'ECONNRESET' )
27- return ;
28- throw e ;
29- } ) ;
18+ worker2 . on ( 'error' , function ( e ) {
19+ console . error ( 'worker2 error' ) ;
20+ // EPIPE is OK on Windows
21+ if ( common . isWindows && e . code === 'EPIPE' )
22+ return ;
23+ throw e ;
24+ } ) ;
25+ conn = net . connect ( common . PORT , common . mustCall ( function ( ) {
26+ worker1 . send ( 'die' ) ;
27+ worker2 . send ( 'die' ) ;
28+ } ) ) ;
29+ conn . on ( 'error' , function ( e ) {
30+ // ECONNRESET is OK
31+ if ( e . code === 'ECONNRESET' )
32+ return ;
33+ throw e ;
3034 } ) ;
3135 } ) ) ;
3236
You can’t perform that action at this time.
0 commit comments