fixes process path being truncated (#885)

This commit is contained in:
Darren Schroeder 2022-01-29 08:50:48 -06:00 committed by GitHub
parent 65ae3160ca
commit dc6f1c496b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -303,12 +303,13 @@ impl ProcessInfo {
/// Name of command /// Name of command
pub fn name(&self) -> String { pub fn name(&self) -> String {
self.command() // self.command()
.split(' ') // .split(' ')
.collect::<Vec<_>>() // .collect::<Vec<_>>()
.first() // .first()
.map(|x| x.to_string()) // .map(|x| x.to_string())
.unwrap_or_default() // .unwrap_or_default()
self.command_only()
} }
/// Full name of command, with arguments /// Full name of command, with arguments
@ -335,6 +336,19 @@ impl ProcessInfo {
} }
} }
/// Full name of comand only
pub fn command_only(&self) -> String {
if let Some(path) = &self.curr_path {
if !path.cmd.is_empty() {
path.exe.to_string_lossy().to_string()
} else {
String::from("")
}
} else {
String::from("")
}
}
/// Get the status of the process /// Get the status of the process
pub fn status(&self) -> String { pub fn status(&self) -> String {
let mut state = 7; let mut state = 7;