2.0.1 • Published 3 years ago

generate-ctrl-c-event v2.0.1

Weekly downloads
23
License
MIT
Repository
github
Last release
3 years ago

generate-ctrl-c-event

Generate ctrl-c (or ctrl-break) events on Windows by calling Kernel32::GenerateConsoleCtrlEvent()

npm version dependencies status optional dependencies status Code Climate maintainability LGTM alerts Known Vulnerabilities GitHub issues welcome GitHub pull requests welcome License: MIT

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>