mirror of
https://github.com/nushell/nushell.git
synced 2024-11-22 16:33:37 +01:00
Use join over custom join code (#4548)
This commit is contained in:
parent
3f14b75153
commit
28b5399fb7
@ -194,17 +194,7 @@ impl ProcessInfo {
|
||||
pub fn command(&self) -> String {
|
||||
if let Ok(cmd) = &self.curr_proc.cmdline() {
|
||||
if !cmd.is_empty() {
|
||||
let mut cmd = cmd
|
||||
.iter()
|
||||
.cloned()
|
||||
.map(|mut x| {
|
||||
x.push(' ');
|
||||
x
|
||||
})
|
||||
.collect::<String>();
|
||||
cmd.pop();
|
||||
cmd = cmd.replace("\n", " ").replace("\t", " ");
|
||||
cmd
|
||||
cmd.join(" ").replace("\n", " ").replace("\t", " ")
|
||||
} else {
|
||||
self.curr_proc.stat().comm.clone()
|
||||
}
|
||||
|
@ -316,18 +316,7 @@ impl ProcessInfo {
|
||||
pub fn command(&self) -> String {
|
||||
if let Some(path) = &self.curr_path {
|
||||
if !path.cmd.is_empty() {
|
||||
let mut cmd = path
|
||||
.cmd
|
||||
.iter()
|
||||
.cloned()
|
||||
.map(|mut x| {
|
||||
x.push(' ');
|
||||
x
|
||||
})
|
||||
.collect::<String>();
|
||||
cmd.pop();
|
||||
cmd = cmd.replace("\n", " ").replace("\t", " ");
|
||||
cmd
|
||||
path.cmd.join(" ").replace("\n", " ").replace("\t", " ")
|
||||
} else {
|
||||
String::from("")
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user