From 2f30d2b1bc8ac07a6981f1848cab9152b9da91e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=98=B3=E5=85=89=E5=B0=91=E5=B9=B4?= <849317537@qq.com> Date: Wed, 7 Aug 2024 02:00:36 +0000 Subject: [PATCH] =?UTF-8?q?=E5=8A=9F=E8=83=BD=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main.rs b/src/main.rs index f2225f6..b4df653 100644 --- a/src/main.rs +++ b/src/main.rs @@ -477,7 +477,7 @@ fn stop_container(containers_id: &str, is_remove: bool) -> Result<()> { let container_merged_path = container_work_path.join("merged"); // 正在运行中的需要 kill if container_info.status == ContainerStatus::RUNNING { - kill(Pid::from_raw(container_info.pid), Signal::SIGTERM)?; + let _ = kill(Pid::from_raw(container_info.pid), Signal::SIGTERM); } // 卸载自定义挂载点 if container_info.volume != "" { @@ -487,14 +487,14 @@ fn stop_container(containers_id: &str, is_remove: bool) -> Result<()> { .map(|v| container_merged_path.join(v).to_string_lossy().to_string()) .for_each(|s| { match umount(s.as_str()) { - Ok(s) => println!("卸载自定卷: {s:?}"), + Ok(_) => println!("卸载自定卷"), Err(e) => panic!("卸载卷失败: {e:?}"), } }); } // 卸载overlayfs match umount(container_merged_path.to_str().unwrap()) { - Ok(s) => println!("卸载overlayfs卷: {s:?}"), + Ok(_) => println!("卸载overlayfs卷"), Err(e) => println!("卸载overlayfs失败: {e:?}"), } @@ -502,7 +502,7 @@ fn stop_container(containers_id: &str, is_remove: bool) -> Result<()> { // 删除容器目录 if is_remove { match fs::remove_dir_all(container_work_path) { - Ok(s) => println!("删除容器 {container_id} 成功"), + Ok(_) => println!("删除容器 {container_id} 成功"), Err(e) => println!("删除容器失败: {e:?}"), } }