Merge pull request #138 from lifupan/master

grpc: fix the issue of crash agent when didn't find the process
This commit is contained in:
James O. D. Hunt 2020-02-25 10:53:00 +00:00 committed by GitHub
commit 7965445adf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -926,7 +926,19 @@ impl protocols::agent_grpc::AgentService for agentService {
let eid = req.exec_id.clone(); let eid = req.exec_id.clone();
let s = Arc::clone(&self.sandbox); let s = Arc::clone(&self.sandbox);
let mut sandbox = s.lock().unwrap(); let mut sandbox = s.lock().unwrap();
let p = find_process(&mut sandbox, cid.as_str(), eid.as_str(), false).unwrap(); let p = match find_process(&mut sandbox, cid.as_str(), eid.as_str(), false) {
Ok(v) => v,
Err(e) => {
let f = sink
.fail(RpcStatus::new(
RpcStatusCode::InvalidArgument,
Some(format!("invalid argument: {}", e)),
))
.map_err(|_e| error!(sl!(), "invalid argument"));
ctx.spawn(f);
return;
}
};
if p.term_master.is_none() { if p.term_master.is_none() {
let f = sink let f = sink