Skip to content

Commit

Permalink
Don't wait forever if an error occurs while restic is still running
Browse files Browse the repository at this point in the history
  • Loading branch information
clonejo committed Feb 4, 2025
1 parent 393128b commit 58ef7df
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/restic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -277,8 +277,8 @@ impl<T> Iter<T> {

fn read_stderr<U>(&mut self, kind: ErrorKind) -> Result<U, Error> {
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)),
Expand Down

0 comments on commit 58ef7df

Please sign in to comment.