Skip to content

Commit

Permalink
Avoid panic when sending errors after receiver shutdown
Browse files Browse the repository at this point in the history
  • Loading branch information
sharkdp committed Oct 28, 2020
1 parent e0adb45 commit b2fa188
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 10 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

## Bugfixes

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

Expand Down
28 changes: 18 additions & 10 deletions src/walk.rs
Original file line number Diff line number Diff line change
Expand Up @@ -358,19 +358,27 @@ fn spawn_senders(
DirEntry::BrokenSymlink(path)
}
_ => {
tx_thread
.send(WorkerResult::Error(ignore::Error::WithPath {
path,
err: inner_err,
}))
.unwrap();
match tx_thread.send(WorkerResult::Error(ignore::Error::WithPath {
path,
err: inner_err,
})) {
Ok(_) => {
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 {
Expand Down

0 comments on commit b2fa188

Please sign in to comment.