Skip to content

Commit

Permalink
check process state while exec delete
Browse files Browse the repository at this point in the history
  • Loading branch information
mingfukuang committed Jul 30, 2024
1 parent 369a73f commit 2590179
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions crates/runc-shim/src/runc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -456,6 +456,9 @@ impl ProcessLifecycle<ExecProcess> for RuncExecLifecycle {
}

async fn delete(&self, p: &mut ExecProcess) -> Result<()> {
if p.state == Status::RUNNING {
return Err(Error::Other("cannot delete a running process".to_string()));
}
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();
Expand Down

0 comments on commit 2590179

Please sign in to comment.