From dc6f1c496b38ac22c232597cd4aba77fc45b89bf Mon Sep 17 00:00:00 2001 From: Darren Schroeder <343840+fdncred@users.noreply.github.com> Date: Sat, 29 Jan 2022 08:50:48 -0600 Subject: [PATCH] fixes process path being truncated (#885) --- crates/nu-system/src/macos.rs | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/crates/nu-system/src/macos.rs b/crates/nu-system/src/macos.rs index e6ae3d9ac6..db72450347 100644 --- a/crates/nu-system/src/macos.rs +++ b/crates/nu-system/src/macos.rs @@ -303,12 +303,13 @@ impl ProcessInfo { /// Name of command pub fn name(&self) -> String { - self.command() - .split(' ') - .collect::>() - .first() - .map(|x| x.to_string()) - .unwrap_or_default() + // self.command() + // .split(' ') + // .collect::>() + // .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;