Files
tauri/lib/rust/src/process.rs
nothingismagick a1c46cd86f Feature/whitelist (#9)
* feat(proton) whitelist API features

* feat(whitelist) fix feature name for execute cmd

* fix(whitelist) conflicting command names with q-app

* feat(rust2018) cleanup (#8)

* rust 2018 edition changes

* fix whitespace

* change super::super to crate
2019-07-23 17:41:16 -03:00

19 lines
578 B
Rust

use sysinfo;
pub use sysinfo::{Process, ProcessExt, Signal, System, SystemExt};
pub fn get_parent_process(system: &mut sysinfo::System) -> Result<&Process, String> {
let pid = sysinfo::get_current_pid().unwrap();
system.refresh_process(pid);
let current_process = system
.get_process(pid)
.ok_or("Could not get current process")?;
let parent_pid = current_process.parent().ok_or("Could not get parent PID")?;
let parent_process = system
.get_process(parent_pid)
.ok_or("Could not get parent process")?;
println!("{}", pid);
Ok(parent_process)
}