lib/childProcess.js
function signalTerm(childProcess, callback) {
  childProcess.emit('signalTerm');
  if (IS_WINDOWS) {
    // On Windows, there is no such way as SIGTERM or SIGINT. The closest
    // thing is to interrupt the process with Ctrl+C. Under the hood, that
    // generates '\u0003' character on stdin of the process and if
    // the process listens on stdin, it's able to catch this as 'SIGINT'.
    //
    // However, that only works if user does it manually. There is no
    // way to do it programmatically, at least not in Node.js (and even
    // for C/C++, all the solutions are dirty hacks). Even if you send
    // the very same character to stdin of the process, it's not
    // recognized (the rl.on('SIGINT') event won't get triggered)
    // for some reason.
    //
    // The only thing Dredd is left with is a convention. So when Dredd
    // wants to gracefully signal to the child process it should terminate,
    // it sends the '\u0003' to stdin of the child. It's up to the child
    // to implement reading from stdin in such way it works both for
    // programmatic and manual Ctrl+C.
    childProcess.stdin.write(String.fromCharCode(ASCII_CTRL_C));
  } else {
    childProcess.kill('SIGTERM');
  }
  process.nextTick(callback);
}
function signalTerm(childProcess, callback) {
  childProcess.emit('signalTerm');
  if (IS_WINDOWS) {
    // On Windows, there is no such way as SIGTERM or SIGINT. The closest
    // thing is to interrupt the process with Ctrl+C. Under the hood, that
    // generates '\u0003' character on stdin of the process and if
    // the process listens on stdin, it's able to catch this as 'SIGINT'.
    //
    // However, that only works if user does it manually. There is no
    // way to do it programmatically, at least not in Node.js (and even
    // for C/C++, all the solutions are dirty hacks). Even if you send
    // the very same character to stdin of the process, it's not
    // recognized (the rl.on('SIGINT') event won't get triggered)
    // for some reason.
    //
    // The only thing Dredd is left with is a convention. So when Dredd
    // wants to gracefully signal to the child process it should terminate,
    // it sends the '\u0003' to stdin of the child. It's up to the child
    // to implement reading from stdin in such way it works both for
    // programmatic and manual Ctrl+C.
    childProcess.stdin.write(String.fromCharCode(ASCII_CTRL_C));
  } else {
    childProcess.kill('SIGTERM');
  }
  process.nextTick(callback);
}
function signalTerm ( childProcess , callback ) { childProcess . emit ( 'signalTerm' ) ; if ( IS_WINDOWS ) { // On Windows, there is no such way as SIGTERM or SIGINT. The closest // thing is to interrupt the process with Ctrl+C. Under the hood, that // generates '\u0003' character on stdin of the process and if // the process listens on stdin, it's able to catch this as 'SIGINT'. // // However, that only works if user does it manually. There is no // way to do it programmatically, at least not in Node.js (and even // for C/C++, all the solutions are dirty hacks). Even if you send // the very same character to stdin of the process, it's not // recognized (the rl.on('SIGINT') event won't get triggered) // for some reason. // // The only thing Dredd is left with is a convention. So when Dredd // wants to gracefully signal to the child process it should terminate, // it sends the '\u0003' to stdin of the child. It's up to the child // to implement reading from stdin in such way it works both for // programmatic and manual Ctrl+C. childProcess . stdin . write ( String . fromCharCode ( ASCII_CTRL_C ) ) ; } else { childProcess . kill ( 'SIGTERM' ) ; } process . nextTick ( callback ) ; }
Signals the child process to gracefully terminate
Signals the child process to gracefully terminate