watchexec/cargo-watch

Ability to modify signal used to terminate process and/or wait for shutdown?

brownjohnf opened this issue · 3 comments

I love cargo watch, and use it all the time. I'm hitting an issue now though where I need to perform some cleanup/teardown prior to shutting down the watched process (I need some syscalls to complete in order to be able to re-run the process).

Unless I'm missing something, there's no ability to add a delay or customize the shutdown signal sent to the process, is that correct? I think in a perfect world, I'd be able to send a SIGINT, wait some number of seconds, and then follow it up with a SIGKILL if the process still hadn't exited.

Apologies if I'm missing some combination of features that make this already possible. I'm also open to contributing, if this is a feature that doesn't exist but you're interested in. Thanks!

Watchexec can do most of it (send a signal, wait 60 seconds, sigkill), though there's an outstanding bug watchexec/watchexec#426 where it doesn't quite work correctly (it waits 60 seconds regardless of whether the program ends after the signal or not). Eventually that will come to cargo watch. I'm not currently working on watchexec/cargo-watch due to motivation and other projects taking precedence.