Version: Deno 2.8.2
Hi,
I would like to report a behavior in Deno that can be reproduced using the below snippet:
import { promises as fs } from "node:fs";
const dir = await fs.opendir(".");
// create async iterator from the Dir handle
const iter = dir[Symbol.asyncIterator]();
// start reading one entry
await iter.next();
// close the directory while iterator is still “live”
await dir.close();
// now try to continue iteration
await iter.next();
Expected behavior
root@KContainer:~/16622# node a.mjs
node:internal/fs/dir:254
process.nextTick(callback, new ERR_DIR_CLOSED());
^
Error [ERR_DIR_CLOSED]: Directory handle was closed
at Dir.close (node:internal/fs/dir:254:34)
at node:internal/util:500:21
at new Promise (<anonymous>)
at Dir.close (node:internal/util:486:12)
at Dir.entries (node:internal/fs/dir:304:35)
at async file:///home/c01kele/16622/a.mjs:15:1 {
code: 'ERR_DIR_CLOSED'
}
Node.js v24.13.1
Actual behavior
No error is thrown; iteration continues or resolves without enforcing the closed state.
Version: Deno 2.8.2
Hi,
I would like to report a behavior in Deno that can be reproduced using the below snippet:
Expected behavior
Actual behavior
No error is thrown; iteration continues or resolves without enforcing the closed state.