- Version 2.0.0
- No dependencies
- BSD-3-Clause license
npm i cleankill
yarn add cleankill
pnpm add cleankill
Hook SIGINT and cleanly shut down your async code
close: () => Promise<void>;
Call all interrupt handlers, and call the callback when they all complete.
Clears the list of interrupt handlers.
interrupt: () => void;
Calls all interrupt handlers, then exits with exit code 0.
If called more than once it skips waiting for the interrupt handlers to finish and exits with exit code 1. If there are any errors with interrupt handlers, the process exits immediately with exit code 2.
This function is called when a SIGINT is received.
onInterrupt: (handler: Handler) => void;
Register a handler to occur on SIGINT. The handler must return a promise if it has any asynchronous work to do. The process will be terminated once all handlers complete. If a handler throws or the promise it returns rejects then the process will be terminated immediately.
promiseAllStrict: (promises: Promise<any>) => Promise<void>;
Waits for all promises to settle, then rejects with the first error, if any.
type Handler = () => Promise<void>;
The type of a cleankill interrupt handler.
Package Files (1)
Dev Dependencies (1)
Peer Dependencies (0)
No peer dependencies.
To add a badge like this oneto your package's README, use the codes available below.
You may also use Shields.io to create a custom badge linking to
- HTML<a href="https://www.jsdocs.io/package/cleankill"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>
- Updated .
Package analyzed in 320 ms.
- Missing or incorrect documentation? Open an issue for this package.