简体   繁体   中英

Send signals to a debugged nodejs application in Visual Studio Code

I have a simple nodejs application like

...
function checkTermination () {
  console.log('start closing ...');
  ...
}
process.on('SIGTERM', checkTermination);
process.on('SIGINT', checkTermination);

I'm debugging it with Visual Studio Code.

Is there an opportunity to send some signals like SIGINT , SIGTERM to the application with "Visual Studio Code" ? How can I do this?

  1. Find the process ID
  2. Send the Signal

I have a program named test.js, attached to VS code.

ps aux | grep node | grep test
//Result
user1           3580   0.0  0.2  3115916  35648   ??  S     3:29PM   0:00.29 /usr/local/bin/node --inspect-brk=48750 test.js
// Send the signal
kill -TERM 3580 // 3580 is the PID

在此处输入图片说明

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM