简体   繁体   English

将信号发送到 Visual Studio Code 中已调试的 nodejs 应用程序

[英]Send signals to a debugged nodejs application in Visual Studio Code

I have a simple nodejs application like我有一个简单的 nodejs 应用程序,例如

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

I'm debugging it with Visual Studio Code.我正在使用 Visual Studio Code 调试它。

Is there an opportunity to send some signals like SIGINT , SIGTERM to the application with "Visual Studio Code" ?是否有机会使用“Visual Studio Code”向应用程序发送诸如SIGINTSIGTERM类的SIGINT How can I do this?我怎样才能做到这一点?

  1. Find the process ID查找进程ID
  2. Send the Signal发送信号

I have a program named test.js, attached to VS code.我有一个名为 test.js 的程序,附加到 VS 代码。

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

在此处输入图片说明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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