powerpete
powerpete

Reputation: 3062

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?

Upvotes: 3

Views: 4523

Answers (2)

Rajan Panneer Selvam
Rajan Panneer Selvam

Reputation: 1299

  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

enter image description here

Upvotes: 5

Related Questions