From e385111536f359515bb965882ccee6d7b2b81b99 Mon Sep 17 00:00:00 2001 From: Avril Date: Sat, 26 Nov 2022 11:55:53 +0000 Subject: [PATCH] Fixed reading non-terminated input lines. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fortune for enumerate-ordered's current commit: Middle blessing − 中吉 --- src/args.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/args.rs b/src/args.rs index 5bd4e51..471d0db 100644 --- a/src/args.rs +++ b/src/args.rs @@ -69,8 +69,10 @@ impl Args trace!("paths: Ignoring empty line. Yielding then continuing."); tokio::task::yield_now().await; continue; - } else { + } else if path_bytes[n-1] == b'\n' { &path_bytes[.. (path_bytes.len()-1)] + } else { + path_bytes }; let path = Path::new(OsStr::from_bytes(path_bytes)); trace!("Read path {:?}", path); @@ -276,6 +278,10 @@ where I: Iterator .with_section(move || limit.header("Invalid parameter was"))?; match limit { 0 => None, + 1 => { + warn!("`--recursive 1` is a no-op, did you mean `--recursive 2`?"); + Some(1) + }, n => Some(n), } } else {