lib/childProcess.js
function check() {
    if (terminated) {
      // Successfully terminated
      clearTimeout(t);
      return callback();
    }
    if ((Date.now() - start) < timeout) {
      // Still not terminated, try again
      signalTerm(childProcess, (err) => {
        if (err) { return callback(err); }
        t = setTimeout(check, retryDelay);
      });
    } else {
      // Still not terminated and the timeout has passed, either
      // kill the process (force) or provide an error
      clearTimeout(t);
      if (force) {
        signalKill(childProcess, callback);
      } else {
        callback(
          new Error(`Unable to gracefully terminate process ${childProcess.pid}`)
        );
      }
    }
  }
function check() {
    if (terminated) {
      // Successfully terminated
      clearTimeout(t);
      return callback();
    }
    if ((Date.now() - start) < timeout) {
      // Still not terminated, try again
      signalTerm(childProcess, (err) => {
        if (err) { return callback(err); }
        t = setTimeout(check, retryDelay);
      });
    } else {
      // Still not terminated and the timeout has passed, either
      // kill the process (force) or provide an error
      clearTimeout(t);
      if (force) {
        signalKill(childProcess, callback);
      } else {
        callback(
          new Error(`Unable to gracefully terminate process ${childProcess.pid}`)
        );
      }
    }
  }
function check ( ) { if ( terminated ) { // Successfully terminated clearTimeout ( t ) ; return callback ( ) ; } if ( ( Date . now ( ) - start ) < timeout ) { // Still not terminated, try again signalTerm ( childProcess , ( err ) => { if ( err ) { return callback ( err ) ; } t = setTimeout ( check , retryDelay ) ; } ) ; } else { // Still not terminated and the timeout has passed, either // kill the process (force) or provide an error clearTimeout ( t ) ; if ( force ) { signalKill ( childProcess , callback ) ; } else { callback ( new Error ( ` ${ childProcess . pid } ` ) ) ; } } }
A function representing one check, whether the process already ended or not. It is repeatedly called until the timeout has passed.
A function representing one check whether the process already ended or not . It is repeatedly called until the timeout has passed .