mirror of
https://github.com/tauri-apps/tauri.git
synced 2026-04-07 10:22:29 +02:00
* 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
19 lines
578 B
Rust
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)
|
|
}
|