Ban*_*San 6 windows powershell posix ipc node.js
我有以下 NodeJS 代码:
setInterval(function() {}, 1e6);
process.on('SIGUSR1', function() {
console.log('Got a signal');
});
Run Code Online (Sandbox Code Playgroud)
在 Unix 中我应该能够使用它kill -s SIGUSR1 1234来发送这个信号。Windows 没有kill命令,我可以看到 Powershell 有,但它似乎没有类似 -s 的选项。
NAME
Stop-Process
SYNTAX
Stop-Process [-Id] <int[]> [-PassThru] [-Force] [-WhatIf] [-Confirm] [<CommonParameters>]
Stop-Process -Name <string[]> [-PassThru] [-Force] [-WhatIf] [-Confirm] [<CommonParameters>]
Stop-Process [-InputObject] <Process[]> [-PassThru] [-Force] [-WhatIf] [-Confirm] [<CommonParameters>]
ALIASES
spps
kill
REMARKS
Get-Help cannot find the Help files for this cmdlet on this computer. It is displaying only partial help.
-- To download and install Help files for the module that includes this cmdlet, use Update-Help.
-- To view the Help topic for this cmdlet online, type: "Get-Help Stop-Process -Online" or
go to http://go.microsoft.com/fwlink/?LinkID=113412.
Run Code Online (Sandbox Code Playgroud)
SIGUSR1那么,如何在 Windows 中发送信号呢?
正如已经提到的,Windows 不支持 UNIX 信号。
但是,SIGUSR1 在 Nodejs 中用于在已经运行的进程上启动调试器,如果这是您想要的功能,您可以使用未记录的 api: process._debugProcess(pid);
这将启动进程的调试器。
| 归档时间: |
|
| 查看次数: |
2254 次 |
| 最近记录: |