2.0.1 • Published 3 years ago
generate-ctrl-c-event v2.0.1
generate-ctrl-c-event
Generate ctrl-c (or ctrl-break) events on Windows by calling Kernel32::GenerateConsoleCtrlEvent()
Only works on Windows.
Cannot be installed on other platforms due to it's package.os
.
If you need to use this in cross-platform code,
install it as an optional dependency
and it will be skipped when installing your package on a non-Windows platforms.
Calls Kernel32::GenerateConsoleCtrlEvent()
,
via either a Foreign Function Interface (FFI) if available, or a PowerShell script as a fallback.
Please consult the official docs on Kernel32::GenerateConsoleCtrlEvent()
for semantics.
Exports:
function generateCtrlC(): boolean
function generateCtrlCAsync(): Promise<boolean>
function generateCtrlBreak(dwProcessGroupId: number = 0): boolean
function generateCtrlBreakAsync(dwProcessGroupId: number = 0): Promise<boolean>