Skip to content

Commit 0911c1c

Browse files
zzzzzzzzzy9mxpv
authored andcommitted
When get_container return an error, just return pid=0 to connect interface
1 parent bd36de0 commit 0911c1c

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

crates/runc-shim/src/task.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -399,11 +399,14 @@ where
399399
req: ConnectRequest,
400400
) -> TtrpcResult<ConnectResponse> {
401401
info!("Connect request for {:?}", req);
402-
let container = self.get_container(req.id()).await?;
402+
let mut pid: u32 = 0;
403+
if let Ok(container) = self.get_container(req.id()).await {
404+
pid = container.pid().await as u32;
405+
}
403406

404407
Ok(ConnectResponse {
405408
shim_pid: std::process::id(),
406-
task_pid: container.pid().await as u32,
409+
task_pid: pid,
407410
..Default::default()
408411
})
409412
}

0 commit comments

Comments
 (0)