refactor: simplify function return types and remove unnecessary wraps

This commit is contained in:
Tunglies
2025-11-15 08:56:58 +08:00
parent 2b0ba4dc95
commit a6cb903fe6
16 changed files with 37 additions and 55 deletions
+2 -13
View File
@@ -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]