On behalf of Nomadic Labs, I’m happy to announce the first release of Lwt-exit, a small opinionated library to cleanly handle exits and signals in applications that use Lwt.
The library is available through opam:
opam install lwt-exit,
hosted on gitlab: https://gitlab.com/nomadic-labs/lwt-exit,
distributed under the MIT license: https://gitlab.com/nomadic-labs/lwt-exit/-/blob/master/LICENSE
and the documentation is available online: https://nomadic-labs.gitlab.io/lwt-exit/
This library is used in the Tezos codebase to clean up system resources (flush buffered writes, cleanly close p2p connections, etc.) during exits. It is also used to attach signal handlers (both for interactive use via Ctrl+C and for daemonisation via systemctl).