zig/lib/std/fs
Ryan Liptak 75e5b38410
std.fs: End iteration on Linux/WASI during Iterator.next when hitting ENOENT
`getdents` on Linux can return `ENOENT` if the directory referred to by the fd is deleted during iteration. Returning null when this happens makes sense because:

- `ENOENT` is specific to the Linux implementation of `getdents`
- On other platforms like FreeBSD, `getdents` returns `0` in this scenario, which is functionally equivalent to the `.NOENT => return null` handling on Linux
- In all the usage sites of `Iterator.next` throughout the standard library, translating `ENOENT` returned from `next` as null was the best way to handle it, so the use-case for handling the exact `ENOENT` scenario specifically may not exist to a relevant extent

Previously, ENOENT being returned would trigger `os.unexpectedErrno`.

Closes #12211
2022-07-25 16:14:25 +03:00
..
file.zig math: make cast return optional instead of an error 2022-05-27 16:43:33 -04:00
get_app_data_dir.zig std/fs: Support XDG_DATA_HOME 2022-01-24 17:33:38 +02:00
path.zig stdlib std.os: Improve wasi-libc parity for WASI CWD emulation 2022-04-16 18:08:05 +02:00
test.zig std.fs: End iteration on Linux/WASI during Iterator.next when hitting ENOENT 2022-07-25 16:14:25 +03:00
wasi.zig stdlib std.os: Improve wasi-libc parity for WASI CWD emulation 2022-04-16 18:08:05 +02:00
watch.zig fs: Use OpenMode enum instead of read/write flags. 2022-01-29 15:52:08 +02:00