code: function ProcessWatcher(pid, parent) {
      var self = this;
  
      this.dead = false;
  
      // check first if process is alive
      if (exports.alive(pid) === false) {
        process.nextTick(function () {
          self.dead = true;
          self.emit('dead');
        });
        return self;
      }
  
      // use disconnect to detect parent death
      if (parent && exports.support.disconnect) {
        var listen = function() {
          self.dead = true;
          self.stop();
          self.emit('dead');
        }
  
        parent.once('disconnect', listen);
        this.stop = parent.removeListener.bind(null, 'disconnect', listen);
  
        this.on('newListener', function (eventName) {
          if (eventName !== 'cycle') return;
  
          process.nextTick(function () {
            self.emit('cycle');
          });
        });
  
        return self;
      }
  
      // fallback to an setInterval try/catch check
      var timer = setInterval(function () {
        if (exports.alive(pid) === false) {
          self.dead = true;
          self.stop();
          self.emit('dead');
        }
        self.emit('cycle');
      });
      this.stop = clearInterval.bind(null, timer);
    }
docs: continusely check if process alive and execute callback when the process is missing