fs: synchronize close with other I/O for streams
Part of the flakiness in the
parallel/test-readline-async-iterators-destroy test comes from
fs streams starting _read()
and _destroy()
without waiting
for the other to finish, which can lead to the fs.read()
call
resulting in EBADF
if timing is bad.
Fix this by synchronizing write and read operations with close()
.
Refs: https://github.com/nodejs/node/issues/30660
/cc @ronag
Checklist
-
make -j4 test
(UNIX), orvcbuild test
(Windows) passes -
tests and/or benchmarks are included -
commit message follows commit guidelines