code: function createWorkerExitHandler(port) {
          return function (code, signal) {
              var workerIndex = port - startPort;
  
              workers[workerIndex] = null;
  
              if (code !== 0 || code === null) {
                  console.log('Worker exited with code: ' + code);
  
                  if (!shuttingDown) {
                      // Start worker again after 1 sec
                      setTimeout(function () {
                          if (!workers[workerIndex]) {
                              workers[workerIndex] = startWorker(port);
                          }
                      }, 1000);
                  }
              }
          };
      }
docs: Create a listener function to handle a premature exit event from a worker
  @private
  @param {Number} port The port number of the worker.
  @returns {Function}