mirror of
https://github.com/clash-verge-rev/clash-verge-rev.git
synced 2026-10-24 20:52:15 +08:00
refactor: simplify function return types and remove unnecessary wraps
This commit is contained in:
@@ -1,22 +1,12 @@
|
||||
use anyhow::Result;
|
||||
use tauri_plugin_shell::process::CommandChild;
|
||||
|
||||
use crate::{logging, utils::logging::Type};
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct CommandChildGuard(Option<CommandChild>);
|
||||
|
||||
impl Drop for CommandChildGuard {
|
||||
#[inline]
|
||||
fn drop(&mut self) {
|
||||
if let Err(err) = self.kill() {
|
||||
logging!(
|
||||
error,
|
||||
Type::Service,
|
||||
"Failed to kill child process: {}",
|
||||
err
|
||||
);
|
||||
}
|
||||
self.kill();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,11 +17,10 @@ impl CommandChildGuard {
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn kill(&mut self) -> Result<()> {
|
||||
pub fn kill(&mut self) {
|
||||
if let Some(child) = self.0.take() {
|
||||
let _ = child.kill();
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[inline]
|
||||
|
||||
Reference in New Issue
Block a user