Skip to content

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

License

Notifications You must be signed in to change notification settings

zenflow/generate-ctrl-c-event

Repository files navigation

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>

About

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

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published