@@ -168,7 +168,7 @@ struct FlycheckActor {
168
168
/// doesn't provide a way to read sub-process output without blocking, so we
169
169
/// have to wrap sub-processes output handling in a thread and pass messages
170
170
/// back over a channel.
171
- cargo_handle : Option < CargoHandle > ,
171
+ command_handle : Option < CommandHandle > ,
172
172
}
173
173
174
174
enum Event {
@@ -184,15 +184,15 @@ impl FlycheckActor {
184
184
workspace_root : AbsPathBuf ,
185
185
) -> FlycheckActor {
186
186
tracing:: info!( %id, ?workspace_root, "Spawning flycheck" ) ;
187
- FlycheckActor { id, sender, config, root : workspace_root, cargo_handle : None }
187
+ FlycheckActor { id, sender, config, root : workspace_root, command_handle : None }
188
188
}
189
189
190
190
fn report_progress ( & self , progress : Progress ) {
191
191
self . send ( Message :: Progress { id : self . id , progress } ) ;
192
192
}
193
193
194
194
fn next_event ( & self , inbox : & Receiver < StateChange > ) -> Option < Event > {
195
- let check_chan = self . cargo_handle . as_ref ( ) . map ( |cargo| & cargo. receiver ) ;
195
+ let check_chan = self . command_handle . as_ref ( ) . map ( |cargo| & cargo. receiver ) ;
196
196
if let Ok ( msg) = inbox. try_recv ( ) {
197
197
// give restarts a preference so check outputs don't block a restart or stop
198
198
return Some ( Event :: RequestStateChange ( msg) ) ;
@@ -222,13 +222,13 @@ impl FlycheckActor {
222
222
223
223
let command = self . check_command ( ) ;
224
224
tracing:: debug!( ?command, "will restart flycheck" ) ;
225
- match CargoHandle :: spawn ( command) {
226
- Ok ( cargo_handle ) => {
225
+ match CommandHandle :: spawn ( command) {
226
+ Ok ( command_handle ) => {
227
227
tracing:: debug!(
228
228
command = ?self . check_command( ) ,
229
229
"did restart flycheck"
230
230
) ;
231
- self . cargo_handle = Some ( cargo_handle ) ;
231
+ self . command_handle = Some ( command_handle ) ;
232
232
self . report_progress ( Progress :: DidStart ) ;
233
233
}
234
234
Err ( error) => {
@@ -244,8 +244,8 @@ impl FlycheckActor {
244
244
tracing:: debug!( flycheck_id = self . id, "flycheck finished" ) ;
245
245
246
246
// Watcher finished
247
- let cargo_handle = self . cargo_handle . take ( ) . unwrap ( ) ;
248
- let res = cargo_handle . join ( ) ;
247
+ let command_handle = self . command_handle . take ( ) . unwrap ( ) ;
248
+ let res = command_handle . join ( ) ;
249
249
if res. is_err ( ) {
250
250
tracing:: error!(
251
251
"Flycheck failed to run the following command: {:?}" ,
@@ -284,12 +284,12 @@ impl FlycheckActor {
284
284
}
285
285
286
286
fn cancel_check_process ( & mut self ) {
287
- if let Some ( cargo_handle ) = self . cargo_handle . take ( ) {
287
+ if let Some ( command_handle ) = self . command_handle . take ( ) {
288
288
tracing:: debug!(
289
289
command = ?self . check_command( ) ,
290
290
"did cancel flycheck"
291
291
) ;
292
- cargo_handle . cancel ( ) ;
292
+ command_handle . cancel ( ) ;
293
293
self . report_progress ( Progress :: DidCancel ) ;
294
294
}
295
295
}
@@ -391,16 +391,16 @@ impl Drop for JodGroupChild {
391
391
}
392
392
393
393
/// A handle to a cargo process used for fly-checking.
394
- struct CargoHandle {
394
+ struct CommandHandle {
395
395
/// The handle to the actual cargo process. As we cannot cancel directly from with
396
396
/// a read syscall dropping and therefore terminating the process is our best option.
397
397
child : JodGroupChild ,
398
398
thread : stdx:: thread:: JoinHandle < io:: Result < ( bool , String ) > > ,
399
399
receiver : Receiver < CargoMessage > ,
400
400
}
401
401
402
- impl CargoHandle {
403
- fn spawn ( mut command : Command ) -> std:: io:: Result < CargoHandle > {
402
+ impl CommandHandle {
403
+ fn spawn ( mut command : Command ) -> std:: io:: Result < CommandHandle > {
404
404
command. stdout ( Stdio :: piped ( ) ) . stderr ( Stdio :: piped ( ) ) . stdin ( Stdio :: null ( ) ) ;
405
405
let mut child = command. group_spawn ( ) . map ( JodGroupChild ) ?;
406
406
@@ -413,7 +413,7 @@ impl CargoHandle {
413
413
. name ( "CargoHandle" . to_owned ( ) )
414
414
. spawn ( move || actor. run ( ) )
415
415
. expect ( "failed to spawn thread" ) ;
416
- Ok ( CargoHandle { child, thread, receiver } )
416
+ Ok ( CommandHandle { child, thread, receiver } )
417
417
}
418
418
419
419
fn cancel ( mut self ) {
0 commit comments