From d0a4148da692d49d2174ddd6c7d66c67d1416cc5 Mon Sep 17 00:00:00 2001 From: Zhang Tianyang Date: Fri, 19 Jan 2024 18:38:37 +0800 Subject: [PATCH] task: fix leading files for exec process Signed-off-by: Zhang Tianyang --- vmm/task/src/container.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/vmm/task/src/container.rs b/vmm/task/src/container.rs index fbcabd23..673ac804 100644 --- a/vmm/task/src/container.rs +++ b/vmm/task/src/container.rs @@ -47,7 +47,7 @@ use oci_spec::runtime::{LinuxResources, Process, Spec}; use runc::{options::GlobalOpts, Runc, Spawner}; use serde::Deserialize; use tokio::{ - fs::File, + fs::{remove_file, File}, io::{AsyncBufReadExt, AsyncRead, AsyncReadExt, BufReader}, process::Command, sync::Mutex, @@ -494,8 +494,10 @@ impl ProcessLifecycle for KuasarExecLifecycle { } } - async fn delete(&self, _p: &mut ExecProcess) -> containerd_shim::Result<()> { + async fn delete(&self, p: &mut ExecProcess) -> Result<()> { self.exit_signal.signal(); + let exec_pid_path = Path::new(self.bundle.as_str()).join(format!("{}.pid", p.id)); + remove_file(exec_pid_path).await.unwrap_or_default(); Ok(()) }