Fix bug introduced in c00e5d where hishtory import would fail if shell history files didn't exist (e.g. because the user had never used zsh)

This commit is contained in:
David Dworken 2023-09-23 20:37:41 -07:00
parent c21d443fa6
commit e3c70beb6b
No known key found for this signature in database

View File

@ -387,7 +387,7 @@ func Values[Slice ~[]Elem, Elem any](s Slice) Seq2[Elem, error] {
func readFileToIterator(path string) Seq2[string, error] {
return func(yield func(string, error) bool) bool {
if _, err := os.Stat(path); errors.Is(err, os.ErrNotExist) {
return yield("", fmt.Errorf("file does not exist: %w", err))
return true
}
file, err := os.Open(path)
if err != nil {