19

I know it's possible to send SIGTERM, SIGINT, etc. to your own process in the C programming language:

https://www.gnu.org/software/libc/manual/html_node/Signaling-Yourself.html

Does Node.js provide this functionality?

Shivanshu Goyal
  • 1,227
  • 1
  • 15
  • 21

1 Answers1

28

process.kill(process.pid, "SIGINT");

process.kill sends a signal (SIGINT in this case, provided by the second parameter), to a provided PID. (process.pid in this case, which is the PID of the running node process.)

Source: https://nodejs.org/api/process.html#process_process_kill_pid_signal

skiilaa
  • 1,061
  • 9
  • 18
  • Thanks. I was looking for this. It works for me. The next question, how to stop debugging? E.g. stop listening and drop attached debuggers? – Evgheni Calcutin Mar 15 '22 at 17:01