https://github.com/denosaurs/exit
🧹 Execute function when you program is exiting
https://github.com/denosaurs/exit
cli deno exit process tty
Last synced: 7 days ago
JSON representation
🧹 Execute function when you program is exiting
- Host: GitHub
- URL: https://github.com/denosaurs/exit
- Owner: denosaurs
- License: mit
- Created: 2020-08-25T18:44:17.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2020-09-04T07:34:49.000Z (almost 5 years ago)
- Last Synced: 2025-06-02T06:11:40.199Z (16 days ago)
- Topics: cli, deno, exit, process, tty
- Language: TypeScript
- Homepage: https://deno.land/x/exit
- Size: 9.77 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# exit
[](https://github.com/denosaurs/exit/releases)
[](https://github.com/denosaurs/exit/actions)
[](https://github.com/denosaurs/exit/blob/master/LICENSE)Handle `SIGQUIT`, `SIGINT`, and `SIGTERM` in your application.
---
> ⚠️ Signals are still not very well supported in deno. As APIs become more stable this library will be updated. Currently not supported for windows
---
```typescript
import { onExit, exit } from "https://deno.land/x/exit/mod.ts";onExit(() => {
console.log("Program is exiting, doing some cleanup!");
});onExit(async () => {
console.log("I will be called after the first one!");
});exit(0); // needed as signal hooks need to be disposed
```## Other
### Contribution
Pull request, issues and feedback are very welcome. Code style is formatted with deno fmt and commit messages are done following Conventional Commits spec.
### Licence
Copyright 2020-present, the denosaurs team. All rights reserved. MIT license.