(&self)
| 282 | } |
| 283 | |
| 284 | pub fn stop(&self) -> Result<()> { |
| 285 | let mut state = self.lock(); |
| 286 | state.started = false; |
| 287 | let is_running = state.status.is_running(); |
| 288 | let Some(stop_tx) = state.kill_tx.take() else { |
| 289 | if is_running { |
| 290 | bail!("Missing kill tx for process"); |
| 291 | } |
| 292 | return Ok(()); |
| 293 | }; |
| 294 | match stop_tx.send(()) { |
| 295 | Ok(()) => Ok(()), |
| 296 | Err(()) => match is_running { |
| 297 | true => bail!("Failed to send stop signal to process"), |
| 298 | false => Ok(()), |
| 299 | }, |
| 300 | } |
| 301 | } |
| 302 | |
| 303 | pub fn info(&self) -> ProcessInfo { |
| 304 | let state = self.lock(); |
no test coverage detected