@syncify/kill
v0.0.4
Published
Process exist hooks and keypress sequence interception pre-runner utilities.
Downloads
94
Readme
@syncify/kill
Task execution before process.exit
operations.
Installation
pnpm add @syncify/kill -D
Usage
import { kill, prexit } from '@syncify/kill';
// Process exit tasks
const dispose = kill(() => {
console.log('Called before process exit fires');
});
dispose() // dispose the hook
kill.exit() // disposes of all hooks
kill.exit(0) // same as above but process.exit(0) at the end.
// Process exit keypress sequence interception
prexit(async () => {
console.log('Called before process exit and kill');
await new Promise(resolve => setTimeout(resolve, 2000));
console.log('Prexit will now trigger process.exit(0)');
});