Skip to content

Commit

Permalink
The task_dir successfully cleans when the file is absent
Browse files Browse the repository at this point in the history
Signed-off-by: fengwei0328 <[email protected]>
  • Loading branch information
fengwei0328 committed Nov 25, 2024
1 parent 6d496ef commit 4510a34
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions crates/runc-shim/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,9 @@ impl Shim for Service {
let namespace = self.namespace.as_str();
let bundle = current_dir().map_err(io_error!(e, "get current dir"))?;
let opts = read_options(&bundle).await?;
let runtime = read_runtime(&bundle).await?;
let runtime = read_runtime(&bundle)
.await
.unwrap_or_default();

let runc = create_runc(
&runtime,
Expand All @@ -117,7 +119,9 @@ impl Shim for Service {
&opts,
Some(Arc::new(ShimExecutor::default())),
)?;
let pid = read_pid_from_file(&bundle.join(INIT_PID_FILE)).await?;
let pid = read_pid_from_file(&bundle.join(INIT_PID_FILE))
.await
.unwrap_or_default();

runc.delete(&self.id, Some(&DeleteOpts { force: true }))
.await
Expand Down

0 comments on commit 4510a34

Please sign in to comment.