From 56dfa16b84098cd29de2dc5fa5adf0ce5fcd0df6 Mon Sep 17 00:00:00 2001 From: Karcsesz Date: Fri, 8 Mar 2024 23:28:56 +0100 Subject: [PATCH] Fix --handles_are_files hanging the fetch process by using a much simpler file reading method --- src/editor/commands/fetch.rs | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/src/editor/commands/fetch.rs b/src/editor/commands/fetch.rs index 07695f1..8bf667c 100644 --- a/src/editor/commands/fetch.rs +++ b/src/editor/commands/fetch.rs @@ -15,15 +15,9 @@ pub fn fetch( ) { let handles = handles.flat_map(|handle| { if handles_are_files { - match std::fs::File::open(&handle) { + match std::fs::read_to_string(&handle) { Ok(file) => { - let mut file = BufReader::new(file); - let mut handles = vec![]; - let mut buf = String::new(); - while file.read_line(&mut buf).is_ok() { - handles.push(buf); - buf = String::new(); - } + let handles = file.lines().map(str::to_string).collect::>(); info!("Read {} handles from {handle}", handles.len()); handles }