Fixed reading non-terminated input lines.

Fortune for enumerate-ordered's current commit: Middle blessing − 中吉
master
Avril 2 years ago
parent dd5c20282b
commit e385111536
Signed by: flanchan
GPG Key ID: 284488987C31F630

@ -69,8 +69,10 @@ impl Args
trace!("paths: Ignoring empty line. Yielding then continuing."); trace!("paths: Ignoring empty line. Yielding then continuing.");
tokio::task::yield_now().await; tokio::task::yield_now().await;
continue; continue;
} else { } else if path_bytes[n-1] == b'\n' {
&path_bytes[.. (path_bytes.len()-1)] &path_bytes[.. (path_bytes.len()-1)]
} else {
path_bytes
}; };
let path = Path::new(OsStr::from_bytes(path_bytes)); let path = Path::new(OsStr::from_bytes(path_bytes));
trace!("Read path {:?}", path); trace!("Read path {:?}", path);
@ -276,6 +278,10 @@ where I: Iterator<Item = String>
.with_section(move || limit.header("Invalid parameter was"))?; .with_section(move || limit.header("Invalid parameter was"))?;
match limit { match limit {
0 => None, 0 => None,
1 => {
warn!("`--recursive 1` is a no-op, did you mean `--recursive 2`?");
Some(1)
},
n => Some(n), n => Some(n),
} }
} else { } else {

Loading…
Cancel
Save