Détail du package

generate-ctrl-c-event

zenflow370MIT2.0.2

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

windows, GenerateConsoleCtrlEvent, generate, console

readme

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>

changelog

Changelog

2.0.2 (2025-06-28)

Bug Fixes

  • Set -ExecutionPolicy Bypass on PowerShell script execution (#11) (12fd120)

2.0.1 (2021-07-16)

Bug Fixes

  • include PowerShell script in published package (74076b1)

2.0.0 (2021-04-03)

Features

  • Remove TypeScript type definitions (#10) (0b95798), closes #9

BREAKING CHANGES

  • TS type definitions have been removed

If you need TS types for this package, install the @types/generate-ctrl-c-event package.

1.2.1 (2021-03-27)

Bug Fixes

  • Restore package.json "os" constraint (#7) (f12d959)

1.2.0 (2021-03-22)

Features

  • Add typescript type definitions (#4) (6c701a2), closes #3

1.1.0 (2021-03-22)

Features

  • Add support for generating CTRL-BREAK (#1) (ff30cb0)