【问题标题】:Send signals to a debugged nodejs application in Visual Studio Code在 Visual Studio Code 中向已调试的 nodejs 应用程序发送信号
【发布时间】:2018-05-09 08:53:09
【问题描述】:

我有一个简单的 nodejs 应用程序,比如

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

我正在用 Visual Studio Code 调试它。

是否有机会使用“Visual Studio Code”向应用程序发送SIGINT、SIGTERM 等信号?我该怎么做?

【问题讨论】:

    标签: node.js debugging visual-studio-code


    【解决方案1】:
    1. 查找进程 ID
    2. 发送信号

    我有一个名为 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
    

    【讨论】:

      【解决方案2】:
      猜你喜欢
      • 2016-10-12
      • 2017-07-11
      • 2022-06-15
      • 1970-01-01
      • 2016-12-27
      • 1970-01-01
      • 2022-07-22
      • 1970-01-01
      • 2016-04-01
      相关资源
      最近更新 更多