Is it possible to signal yourself in Node.js?

☆樱花仙子☆ 提交于 2019-12-10 17:13:26

问题


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?


回答1:


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



来源:https://stackoverflow.com/questions/43401165/is-it-possible-to-signal-yourself-in-node-js

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!