Unnamed repository; edit this file 'description' to name the repository.
-rw-r--r--crates/flycheck/src/lib.rs28
1 files changed, 14 insertions, 14 deletions
diff --git a/crates/flycheck/src/lib.rs b/crates/flycheck/src/lib.rs
index fbb943ccb9..7c52eb0b5b 100644
--- a/crates/flycheck/src/lib.rs
+++ b/crates/flycheck/src/lib.rs
@@ -168,7 +168,7 @@ struct FlycheckActor {
/// doesn't provide a way to read sub-process output without blocking, so we
/// have to wrap sub-processes output handling in a thread and pass messages
/// back over a channel.
- cargo_handle: Option<CargoHandle>,
+ command_handle: Option<CommandHandle>,
}
enum Event {
@@ -184,7 +184,7 @@ impl FlycheckActor {
workspace_root: AbsPathBuf,
) -> FlycheckActor {
tracing::info!(%id, ?workspace_root, "Spawning flycheck");
- FlycheckActor { id, sender, config, root: workspace_root, cargo_handle: None }
+ FlycheckActor { id, sender, config, root: workspace_root, command_handle: None }
}
fn report_progress(&self, progress: Progress) {
@@ -192,7 +192,7 @@ impl FlycheckActor {
}
fn next_event(&self, inbox: &Receiver<StateChange>) -> Option<Event> {
- let check_chan = self.cargo_handle.as_ref().map(|cargo| &cargo.receiver);
+ let check_chan = self.command_handle.as_ref().map(|cargo| &cargo.receiver);
if let Ok(msg) = inbox.try_recv() {
// give restarts a preference so check outputs don't block a restart or stop
return Some(Event::RequestStateChange(msg));
@@ -222,13 +222,13 @@ impl FlycheckActor {
let command = self.check_command();
tracing::debug!(?command, "will restart flycheck");
- match CargoHandle::spawn(command) {
- Ok(cargo_handle) => {
+ match CommandHandle::spawn(command) {
+ Ok(command_handle) => {
tracing::debug!(
command = ?self.check_command(),
"did restart flycheck"
);
- self.cargo_handle = Some(cargo_handle);
+ self.command_handle = Some(command_handle);
self.report_progress(Progress::DidStart);
}
Err(error) => {
@@ -244,8 +244,8 @@ impl FlycheckActor {
tracing::debug!(flycheck_id = self.id, "flycheck finished");
// Watcher finished
- let cargo_handle = self.cargo_handle.take().unwrap();
- let res = cargo_handle.join();
+ let command_handle = self.command_handle.take().unwrap();
+ let res = command_handle.join();
if res.is_err() {
tracing::error!(
"Flycheck failed to run the following command: {:?}",
@@ -284,12 +284,12 @@ impl FlycheckActor {
}
fn cancel_check_process(&mut self) {
- if let Some(cargo_handle) = self.cargo_handle.take() {
+ if let Some(command_handle) = self.command_handle.take() {
tracing::debug!(
command = ?self.check_command(),
"did cancel flycheck"
);
- cargo_handle.cancel();
+ command_handle.cancel();
self.report_progress(Progress::DidCancel);
}
}
@@ -391,7 +391,7 @@ impl Drop for JodGroupChild {
}
/// A handle to a cargo process used for fly-checking.
-struct CargoHandle {
+struct CommandHandle {
/// The handle to the actual cargo process. As we cannot cancel directly from with
/// a read syscall dropping and therefore terminating the process is our best option.
child: JodGroupChild,
@@ -399,8 +399,8 @@ struct CargoHandle {
receiver: Receiver<CargoMessage>,
}
-impl CargoHandle {
- fn spawn(mut command: Command) -> std::io::Result<CargoHandle> {
+impl CommandHandle {
+ fn spawn(mut command: Command) -> std::io::Result<CommandHandle> {
command.stdout(Stdio::piped()).stderr(Stdio::piped()).stdin(Stdio::null());
let mut child = command.group_spawn().map(JodGroupChild)?;
@@ -413,7 +413,7 @@ impl CargoHandle {
.name("CargoHandle".to_owned())
.spawn(move || actor.run())
.expect("failed to spawn thread");
- Ok(CargoHandle { child, thread, receiver })
+ Ok(CommandHandle { child, thread, receiver })
}
fn cancel(mut self) {