code: function waitForStartup(err, pid) {
          if (err) {
              throw new Error('Couldn\'t start ' + bin);
          }
  
          if (pid || child.exitCode !== null) {
              child.emit('started');
          } else {
              setTimeout(function () {
                  pidof(bin, waitForStartup);
              }, 100);
          }
      }
docs: Wait for the sudo:d binary to start up