feat: v1.0.2, add feature harden_process

This commit is contained in:
2024-11-20 01:47:32 +08:00
parent 5e6694c53e
commit c939490f0e
4 changed files with 10 additions and 7 deletions

View File

@@ -7,12 +7,12 @@ pub struct Process {
pub exec: Option<PathBuf>,
}
#[cfg(not(target_os = "linux"))]
#[cfg(not(all(target_os = "linux", feature = "harden_process")))]
pub fn get_process(_port: u16) -> Option<Process> {
None
}
#[cfg(target_os = "linux")]
#[cfg(all(target_os = "linux", feature = "harden_process"))]
pub fn get_process(port: u16) -> Option<Process> {
let all_procs = match procfs::process::all_processes() {
Err(e) => {