|
|
@ -10,12 +10,12 @@ struct ProcessInfo { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
pub fn infer_shell() -> Option<Box<dyn Shell>> { |
|
|
|
pub fn infer_shell() -> Option<Box<dyn Shell>> { |
|
|
|
let system = System::new_all(); |
|
|
|
let mut system = System::new(); |
|
|
|
let hashmap = system.processes(); |
|
|
|
|
|
|
|
let mut current_pid = sysinfo::get_current_pid().ok(); |
|
|
|
let mut current_pid = sysinfo::get_current_pid().ok(); |
|
|
|
|
|
|
|
|
|
|
|
while let Some(pid) = current_pid { |
|
|
|
while let Some(pid) = current_pid { |
|
|
|
if let Some(process) = hashmap.get(&pid) { |
|
|
|
system.refresh_process(pid); |
|
|
|
|
|
|
|
if let Some(process) = system.process(pid) { |
|
|
|
current_pid = process.parent(); |
|
|
|
current_pid = process.parent(); |
|
|
|
let process_name = process |
|
|
|
let process_name = process |
|
|
|
.exe() |
|
|
|
.exe() |
|
|
|