Node.js 在Windows中发送SIGUSR1 IPC

Node.js 在Windows中发送SIGUSR1 IPC,node.js,windows,powershell,posix,ipc,Node.js,Windows,Powershell,Posix,Ipc,我有以下NodeJS代码: setInterval(function() {}, 1e6); process.on('SIGUSR1', function() { console.log('Got a signal'); }); 在Unix中,我应该能够使用kill-s SIGUSR1 1234发送此信号。Windows没有kill命令,我可以看到Powershell有,但它似乎没有类似-s的选项 NAME Stop-Process SYNTAX Stop-Proce

我有以下NodeJS代码:

setInterval(function() {}, 1e6);
process.on('SIGUSR1', function() {
    console.log('Got a signal');
});
在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.
名称
停止进程
语法
停止进程[-Id][-PassThru][-Force][-WhatIf][-Confirm][]
停止进程-名称[-PassThru][-Force][-WhatIf][-Confirm][]
停止进程[-InputObject][-PassThru][-Force][-WhatIf][-Confirm][]
别名
SPP
杀死
评论
Get-Help在此计算机上找不到此cmdlet的帮助文件。它只显示部分帮助。
--要下载并安装包含此cmdlet的模块的帮助文件,请使用更新帮助。
--要联机查看此cmdlet的帮助主题,请键入:“获取帮助停止进程-联机”或
去http://go.microsoft.com/fwlink/?LinkID=113412.

那么,如何在Windows中发送
SIGUSR1
信号呢?

正如前面提到的,Windows不支持UNIX信号

但是,在nodejs中,SIGUSR1用于在已经运行的进程上启动调试器,如果这是您想要的功能,您可以使用未记录的api: 过程。调试过程(pid)


这将启动进程上的调试器。

您不需要。窗户里没有信号。使用另一种形式的IPC。好的,很高兴知道。基本上,没有人会使用这个代码吗?我可以通过按Ctrl+C向它发送
SIGINT
。是的,C运行时模拟SIGINT,还提供对raise()的支持,但不提供基于信号的IPC。现在我想起来了,Node.js有可能提供自己的某种信号模拟,尽管我认为不太可能。您可以查看Node.js文档,或者Node.js专家会在这里插话。干杯,如果我发现了什么,我会发布它。