1const cluster = require('cluster'); 2if (cluster.isMaster) { 3 cluster.fork(); // one child 4 cluster.on('exit', function(worker, code, signal) { 5 console.log(`worker terminated with code ${code}`); 6 }); 7} 8