From 87a8c00ee832408454571a227bfcd631de2f61df Mon Sep 17 00:00:00 2001 From: amr-crabnebula Date: Wed, 18 Oct 2023 17:13:29 +0300 Subject: [PATCH] refactor: slice into string instead of stripping suffix --- crates/packager/src/shell.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/packager/src/shell.rs b/crates/packager/src/shell.rs index b9d8bfb8..35b7b5c8 100644 --- a/crates/packager/src/shell.rs +++ b/crates/packager/src/shell.rs @@ -43,7 +43,7 @@ impl CommandExt for Command { if let Ok(0) = stdout.read_line(&mut buf) { break; } - tracing::debug!("{}", buf.strip_suffix('\n').unwrap_or_else(|| &buf)); + tracing::debug!("{}", &buf[0..buf.len() - 1]); lines.extend(buf.as_bytes()); } }); @@ -59,7 +59,7 @@ impl CommandExt for Command { if let Ok(0) = stderr.read_line(&mut buf) { break; } - tracing::debug!("{}", buf.strip_suffix('\n').unwrap_or_else(|| &buf)); + tracing::debug!("{}", &buf[0..buf.len() - 1]); lines.extend(buf.as_bytes()); } });