Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing closedirSync in fs #16622

Open
rboati opened this issue Jan 23, 2025 · 0 comments
Open

Missing closedirSync in fs #16622

rboati opened this issue Jan 23, 2025 · 0 comments
Labels
bug Something isn't working confirmed bug We can reproduce this issue node:fs regression

Comments

@rboati
Copy link

rboati commented Jan 23, 2025

What version of Bun is running?

1.2.0

What platform is your computer?

Linux 6.12.10-amd64 x86_64 unknown

What steps can reproduce the bug?

This function no longer works in bun 1.2:

export async function isDirectoryEmpty(directory) {
	const dirHandle = await fsp.opendir(directory)
	const iter = dirHandle[Symbol.asyncIterator]()
	let next = await iter.next()
	while (!next.done) {
		await dirHandle.close()
		return false
	}
	return true
}

Failing with error message:

TypeError: fs.closedirSync is not a function. (In 'fs.closedirSync(this.#handle)', 'fs.closedirSync' is undefined)
      at close (node:fs:423:27)

What is the expected behavior?

The function should not fail

What do you see instead?

TypeError: fs.closedirSync is not a function. (In 'fs.closedirSync(this.#handle)', 'fs.closedirSync' is undefined)
      at close (node:fs:423:27)

Additional information

The method dirHandle.close() is invoking internally closedirSync() but it cannot find it

@rboati rboati added bug Something isn't working needs triage labels Jan 23, 2025
@pfgithub pfgithub added regression confirmed bug We can reproduce this issue labels Jan 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working confirmed bug We can reproduce this issue node:fs regression
Projects
None yet
Development

No branches or pull requests

3 participants