node.js - 在 Windows 上调试已运行的 node.js 进程

标签 node.js

在 Linux/Unix 平台上,可以通过向 Node.js 进程发送 USR1 信号将其置于 Debug模式。 Windows 没有相同的信号模型,那么有没有办法在 Windows 上将已经运行的 Node.js 进程置于 Debug模式? (换句话说,我想避免必须重新启动进程并向其传递调试标志)

最佳答案

您是否尝试过编写 Node 脚本并使用process.kill(pid, 'SIGUSR1')?我不知道这是否能在 Windows 上按预期工作,但值得一试。

Note that Windows does not support sending Signals, but node offers some emulation with process.kill(), and child_process.kill(): - Sending signal 0 can be used to search for the existence of a process - Sending SIGINT, SIGTERM, and SIGKILL cause the unconditional exit of the target process.

http://nodejs.org/api/process.html#process_signal_events

关于node.js - 在 Windows 上调试已运行的 node.js 进程,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22413940/

相关文章:

javascript - 在函数外部声明变量

javascript - 即使用户已登录,环回也会抛出 accessToken undefined

javascript - 基金会 "Uncaught SyntaxError: Unexpected token import"

javascript - 类型错误 : Cannot read property 'state' of undefined

node.js - Mongoose 4 至 5 : connection. db.collection() 未定义

javascript - 我想在node js中编写一个10秒后退出的计时器程序。但我在 10 点后得到连续输出。请更正我的代码

javascript - 如何使用rabbitmq在nodejs中设计一个任务调度程序,使其在跨多个进程时不会运行相同的任务?

javascript - 如何将javascript数组保存为redis列表

javascript - 文件模块 - node.js

macos - 升级后 NPM 不会运行