1
0
mirror of https://github.com/nushell/nushell.git synced 2025-07-08 02:17:22 +02:00

Use join over custom join code ()

This commit is contained in:
Joseph T. Lyons
2022-02-18 20:07:11 -05:00
committed by GitHub
parent 3f14b75153
commit 28b5399fb7
2 changed files with 2 additions and 23 deletions
crates/nu-system/src

@ -194,17 +194,7 @@ impl ProcessInfo {
pub fn command(&self) -> String { pub fn command(&self) -> String {
if let Ok(cmd) = &self.curr_proc.cmdline() { if let Ok(cmd) = &self.curr_proc.cmdline() {
if !cmd.is_empty() { if !cmd.is_empty() {
let mut cmd = cmd cmd.join(" ").replace("\n", " ").replace("\t", " ")
.iter()
.cloned()
.map(|mut x| {
x.push(' ');
x
})
.collect::<String>();
cmd.pop();
cmd = cmd.replace("\n", " ").replace("\t", " ");
cmd
} else { } else {
self.curr_proc.stat().comm.clone() self.curr_proc.stat().comm.clone()
} }

@ -316,18 +316,7 @@ impl ProcessInfo {
pub fn command(&self) -> String { pub fn command(&self) -> String {
if let Some(path) = &self.curr_path { if let Some(path) = &self.curr_path {
if !path.cmd.is_empty() { if !path.cmd.is_empty() {
let mut cmd = path path.cmd.join(" ").replace("\n", " ").replace("\t", " ")
.cmd
.iter()
.cloned()
.map(|mut x| {
x.push(' ');
x
})
.collect::<String>();
cmd.pop();
cmd = cmd.replace("\n", " ").replace("\t", " ");
cmd
} else { } else {
String::from("") String::from("")
} }