Expand description
cargo kick dev — watch the project’s source tree and restart
the app on save.
Thin wrapper over cargo run. On each batch of debounced file
events under src/ (or any user-supplied path), we kill the
current child and the entire process tree it spawned and
respawn cargo run. stdout/stderr from the child stream through
to the user’s terminal so compile errors and runtime logs land
as they would for a manual cargo run.
Process-tree cleanup: cargo run itself spawns the built
binary. Without explicit tree termination, killing cargo leaves
the app running (and the port bound) across the restart. We
work around that by:
- Spawning cargo in its own process group (Unix
setpgid/ WindowsCREATE_NEW_PROCESS_GROUP). - On kill, sending the signal to the whole group:
kill -KILL -<pgid>on Unix,taskkill /F /T /PIDon Windows.
Result: restart releases the port immediately on both platforms.
Structs§
- DevArgs
- Decoded form of the
devsubcommand.
Enums§
Functions§
- run
- Run the dev loop. Returns only when the user Ctrl-C’s the parent process — the watcher otherwise loops forever.