fix: Fix flycheck sending cancel progress with no running process

This commit is contained in:
Lukas Wirth 2022-06-30 22:58:57 +02:00
parent ce36446943
commit ddddca8717

View File

@ -157,12 +157,9 @@ fn run(mut self, inbox: Receiver<Restart>) {
while let Some(event) = self.next_event(&inbox) {
match event {
Event::Restart(Restart) => {
if let Some(cargo_handle) = self.cargo_handle.take() {
// Cancel the previously spawned process
cargo_handle.cancel();
}
// Cancel the previously spawned process
self.cancel_check_process();
while let Ok(Restart) = inbox.recv_timeout(Duration::from_millis(50)) {}
self.progress(Progress::DidCancel);
let command = self.check_command();
tracing::debug!(?command, "will restart flycheck");
@ -221,6 +218,7 @@ fn cancel_check_process(&mut self) {
self.progress(Progress::DidCancel);
}
}
fn check_command(&self) -> Command {
let mut cmd = match &self.config {
FlycheckConfig::CargoCommand {