#applications #unix-domain-socket #signal #receiving #upon #stop #up

safeword

Gracefully ends a Tokio-based application upon receiving a signal

1 unstable release

Uses old Rust 2015

0.1.0 Aug 18, 2018

#18 in #receiving

21 downloads per month

MIT license

7KB
86 lines

Safeword

Safeword is a library for gracefully ending a Tokio-based application upon receiving a signal.

This could be useful for cleaning up after a program cleanly exits. For example, you might have a server that listens on a Unix domain socket, which does not automatically delete the socket path after the object is dropped. You can run your application with Safeword::run instead of tokio::run and know whether your application was asked to stop, or stopped for another reason (such as the future finishing earlier than you expected).

See the examples for how this might be usefully used.


lib.rs:

Safeword is a library for gracefully ending a [Tokio][tokio]-based application upon receiving a signal.

This could be useful for cleaning up after a program cleanly exits. For example, you might have a server that listens on a Unix domain socket, which does not automatically delete the socket path after the object is dropped. You can run your application with Safeword::run instead of tokio::run and know whether your application was asked to stop, or stopped for another reason (such as the future finishing earlier than you expected).

Use this library with Safeword::run. Inspect the cause of why your code might have failed with Shutdown.

Dependencies

~6MB
~89K SLoC