When killing a process with the process id in the command line interface (hyperTerminal
for windows), the callback function having "Why are you trying to terminate me?!? :-)
" is not getting reflected in the console.
In the first shell I am running using the command node myfilename.js
after running I am getting output as : Node is running as process #processid
and to kill this process,
I am running the command: taskkill /F /PID processid
in a different shell
The Code is given below:
process.stdin.resume();
process.stdin.setEncoding('utf8');
process.on('SIGTERM', function() {
process.stderr.write("Why are you trying to terminate me?!? :-)\n");
});
console.log("Node is running as process #" + process.pid);
After running my command, the process is getting terminated with message:
SUCCESS: The process with PID processid has been terminated.
but in the console I am not getting the output (Why are you trying to terminate me?!? :-)
) which is required.