How to make the following code work?
let mut process_guard: MutexGuard<Option<std::process::Child>> = process.lock().unwrap();
if let Some(child) = *process_guard {
child.kill();
*process_guard = None;
}
Solution:
if let Some(mut child) = (*process_guard).take() {
child.kill();
}