diff --git a/rups/src/blocking/mod.rs b/rups/src/blocking/mod.rs index a0f2d5d..a95526e 100644 --- a/rups/src/blocking/mod.rs +++ b/rups/src/blocking/mod.rs @@ -138,7 +138,7 @@ impl TcpConnection { if debug { eprint!("DEBUG <- {}", raw); } - raw = raw[..raw.len() - 1].to_string(); // Strip off \n + raw = raw.trim_end_matches('\n').to_string(); // Strip off \n // Parse args by splitting whitespace, minding quotes for args with multiple words let args = shell_words::split(&raw) diff --git a/rups/src/tokio/mod.rs b/rups/src/tokio/mod.rs index dc6677a..cf1abf9 100644 --- a/rups/src/tokio/mod.rs +++ b/rups/src/tokio/mod.rs @@ -144,7 +144,7 @@ impl TcpConnection { if debug { eprint!("DEBUG <- {}", raw); } - raw = raw[..raw.len() - 1].to_string(); // Strip off \n + raw = raw.trim_end_matches('\n').to_string(); // Strip off \n // Parse args by splitting whitespace, minding quotes for args with multiple words let args = shell_words::split(&raw)