Avoid panic when sending errors after receiver shutdown

fixes #678
This commit is contained in:
sharkdp 2020-10-27 20:26:34 +01:00 committed by David Peter
parent e0adb45d08
commit b2fa188029
2 changed files with 20 additions and 11 deletions

View File

@ -7,6 +7,7 @@
## Bugfixes ## Bugfixes
- Avoid panic when performing limited searches in directories with restricted permissions, see #678
- Invalid numeric command-line arguments are silently ignored, see #675 - Invalid numeric command-line arguments are silently ignored, see #675
- Disable jemalloc on Android, see #662 - Disable jemalloc on Android, see #662

View File

@ -358,19 +358,27 @@ fn spawn_senders(
DirEntry::BrokenSymlink(path) DirEntry::BrokenSymlink(path)
} }
_ => { _ => {
tx_thread match tx_thread.send(WorkerResult::Error(ignore::Error::WithPath {
.send(WorkerResult::Error(ignore::Error::WithPath { path,
path, err: inner_err,
err: inner_err, })) {
})) Ok(_) => {
.unwrap(); return ignore::WalkState::Continue;
return ignore::WalkState::Continue; }
Err(_) => {
return ignore::WalkState::Quit;
}
}
}
},
Err(err) => match tx_thread.send(WorkerResult::Error(err)) {
Ok(_) => {
return ignore::WalkState::Continue;
}
Err(_) => {
return ignore::WalkState::Quit;
} }
}, },
Err(err) => {
tx_thread.send(WorkerResult::Error(err)).unwrap();
return ignore::WalkState::Continue;
}
}; };
if let Some(min_depth) = config.min_depth { if let Some(min_depth) = config.min_depth {