Function get_current_pid
pub fn get_current_pid() -> Result<Pid, &'static str> ⓘ
Available on crate feature
dep_sysinfo
only.Expand description
Returns the pid for the current process.
Err
is returned in case the platform isn’t supported.
use sysinfo::get_current_pid;
match get_current_pid() {
Ok(pid) => {
println!("current pid: {}", pid);
}
Err(e) => {
println!("failed to get current pid: {}", e);
}
}