Skip to content

Commit

Permalink
Merge pull request #707 from bytedance/fix-unwrap
Browse files Browse the repository at this point in the history
fix process unwrap
  • Loading branch information
yoloyyh authored Nov 8, 2024
2 parents 4d48d28 + d484d22 commit 384c217
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion rasp/librasp/src/process.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,18 @@ impl ProcessInfo {
self.sgid = status.sgid;
self.fuid = status.fuid;
self.fgid = status.fgid;
self.nspid = Self::read_nspid(process.pid).unwrap_or_default().unwrap();
self.nspid = match Self::read_nspid(process.pid) {
Ok(nspid_option) => {
if let Some(nspid) = nspid_option {
nspid
} else {
process.pid
}
}
Err(e) => {
return Err(anyhow!(e));
}
};
Ok(())
}
pub fn update_start_time(&mut self, process: &Process) -> AnyhowResult<f32> {
Expand Down

0 comments on commit 384c217

Please sign in to comment.