-
Notifications
You must be signed in to change notification settings - Fork 81
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ability to modify signal used to terminate process and/or wait for shutdown? #215
Comments
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. |
The aforementioned watchexec issue is solved now. So, I believe cargo-watch could also properly send the termination signal to the process when restarting it due to detected changes. Meanwhile, I just tested ❯ watchexec --exts rs --restart -- cargo run --bin server -- --port 9091 --log debug
[Running: cargo run --bin server -- --port 9091 --log debug]
Finished dev [unoptimized + debuginfo] target(s) in 0.09s
Running `target/debug/server --port 9091 --log debug`
2024-02-10T19:15:42.006302Z INFO server: The server is starting up (pid 300564) ...
2024-02-10T19:15:42.006400Z INFO server: Listening for requests on http://[::1]:9091 ...
2024-02-10T19:15:53.488047Z INFO server: Shutting down gracefully ...
[Running: cargo run --bin server -- --port 9091 --log debug]
|
Yeah, when I upgrade cargo watch's underlying watchexec this will make it in. Unfortunately I have little time to spent on this project at the moment due to external factors... but it will happen eventually! |
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!
The text was updated successfully, but these errors were encountered: