From 153c01a6e37d45ceb59037bb98de7421e05073fc Mon Sep 17 00:00:00 2001 From: clonejo Date: Tue, 4 Feb 2025 20:07:59 +0100 Subject: [PATCH] Don't wait forever if an error occurs while restic is still running --- src/restic.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/restic.rs b/src/restic.rs index 5847d60..3235287 100644 --- a/src/restic.rs +++ b/src/restic.rs @@ -277,8 +277,8 @@ impl Iter { fn read_stderr(&mut self, kind: ErrorKind) -> Result { let mut buf = String::new(); - // FIXME: read_to_string can block forever if child's stdout is not read - // this means we never exit and the error is not shown or logged + // read_to_string would block forever if the child was still running. + let _ = self.child.kill(); match self.child.stderr.take().unwrap().read_to_string(&mut buf) { Err(e) => Err(Error { kind: ErrorKind::Run(RunError::Io(e)),