Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
POSIX says [1]: > If a file is removed from or added to the directory after the most recent > call to opendir() or rewinddir(), whether a subsequent call to readdir() > returns an entry for that file is unspecified. Writing `wasm-opt` output, renaming in a same directory being `readdir()`-ed is unspecified, and can cause the `readdir()` to loop indefinitely on certain filesystems. Fix it by collecting `readdir()` result first before making changes to the directory. [1]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/readdir.html
- Loading branch information