Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
switch from
filter_map()
to map_while()
It's possible for a call to `File::open()` to succeed even if reading from that `File` isn't actually possible due to the `File` being a directory. In such cases, `Lines` can return `Err` infinitely, causing `filter_map()` to diverge while searching for a nonexistant `Ok`. This is a semantic change. `filter_map()` can filter multiple errors before returning lines again, while `map_while()` will stop iterating entirely at the first `Err`. However, errors are unlikely at all since the `file` argument is currently always a preallocated temporary file for collecting `Command` output. This merely mitigates the worst case if `lines_from_file()` is ever used in a way where this error could occur.
- Loading branch information