Fix --handles_are_files hanging the fetch process by using a much simpler file reading method

This commit is contained in:
Karcsesz 2024-03-08 23:28:56 +01:00
parent 2633f655dc
commit 56dfa16b84

View file

@ -15,15 +15,9 @@ pub fn fetch(
) { ) {
let handles = handles.flat_map(|handle| { let handles = handles.flat_map(|handle| {
if handles_are_files { if handles_are_files {
match std::fs::File::open(&handle) { match std::fs::read_to_string(&handle) {
Ok(file) => { Ok(file) => {
let mut file = BufReader::new(file); let handles = file.lines().map(str::to_string).collect::<Vec<_>>();
let mut handles = vec![];
let mut buf = String::new();
while file.read_line(&mut buf).is_ok() {
handles.push(buf);
buf = String::new();
}
info!("Read {} handles from {handle}", handles.len()); info!("Read {} handles from {handle}", handles.len());
handles handles
} }