Skip to content

Commit

Permalink
When get_container return an error, just return pid=0 to connect inte…
Browse files Browse the repository at this point in the history
…rface
  • Loading branch information
zzzzzzzzzy9 committed Aug 1, 2024
1 parent 765111e commit 1f3d533
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions crates/runc-shim/src/task.rs
Original file line number Diff line number Diff line change
Expand Up @@ -399,11 +399,14 @@ where
req: ConnectRequest,
) -> TtrpcResult<ConnectResponse> {
info!("Connect request for {:?}", req);
let container = self.get_container(req.id()).await?;
let mut pid: u32 = 0;
if let Ok(container) = self.get_container(req.id()).await {
pid = container.pid().await as u32;
}

Ok(ConnectResponse {
shim_pid: std::process::id(),
task_pid: container.pid().await as u32,
task_pid: pid,
..Default::default()
})
}
Expand Down

0 comments on commit 1f3d533

Please sign in to comment.