Skip to content
This repository has been archived by the owner on Jan 18, 2025. It is now read-only.

Wait for the commands to finish #73

Closed
vorner opened this issue Jul 26, 2017 · 4 comments
Closed

Wait for the commands to finish #73

vorner opened this issue Jul 26, 2017 · 4 comments

Comments

@vorner
Copy link

vorner commented Jul 26, 2017

Currently, if I let cargo watch execute some long-running command and I save a file again while the command is still running, the command gets killed and is run again.

I'd like an option that would change the behaviour and let the command finish before starting it again. If something was changed while the command was still running (possibly multiple times), it would start it after the previous run completed.

My use case is something like this. I start cargo watch -x doc, open relevant part of documentation in the browser and start editing the documentation comments in the source files. If I save only from time to time, the documentation is rebuilt on each save, the browser reloads the documentation and I can keep an eye on how it looks like and fix any formatting issues, etc. However, if I save too often (which I'm used to), the command never finishes and I get no updates of the documentation in the browser. In my opinion, having less often updates is better than having none at all.

I have similar problem with other scenarios, like running cargo watch -x test --all ‒ it keeps compiling and compiling and never gets to actually run the tests.

@passcod
Copy link
Member

passcod commented Jul 26, 2017

If you can figure out a watchexec command/options that do that, I can add a flag here that would set those.

@vorner
Copy link
Author

vorner commented Jul 26, 2017

I believe the needed flag is not setting restart. This does what I want (well, with a bit different command and limited to only some files to be watched, but it doesn't kill and restart the command):

watchexec -e md -w doc/ make doc

I think setting this to false would solve my problem: https://github.com/passcod/cargo-watch/blob/master/src/main.rs#L146

@passcod
Copy link
Member

passcod commented Jul 26, 2017

Done in 5.1.0.

@passcod passcod closed this as completed Jul 26, 2017
@vorner
Copy link
Author

vorner commented Jul 26, 2017

Thank you, this was super fast :-).

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants