forked from extern/nushell
fixes process path being truncated (#885)
This commit is contained in:
parent
65ae3160ca
commit
dc6f1c496b
@ -303,12 +303,13 @@ impl ProcessInfo {
|
||||
|
||||
/// Name of command
|
||||
pub fn name(&self) -> String {
|
||||
self.command()
|
||||
.split(' ')
|
||||
.collect::<Vec<_>>()
|
||||
.first()
|
||||
.map(|x| x.to_string())
|
||||
.unwrap_or_default()
|
||||
// self.command()
|
||||
// .split(' ')
|
||||
// .collect::<Vec<_>>()
|
||||
// .first()
|
||||
// .map(|x| x.to_string())
|
||||
// .unwrap_or_default()
|
||||
self.command_only()
|
||||
}
|
||||
|
||||
/// 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
|
||||
pub fn status(&self) -> String {
|
||||
let mut state = 7;
|
||||
|
Loading…
Reference in New Issue
Block a user