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

process.chdir issue on Windows test run: EBUSY: Device or resource busy #11904

Closed
nobkd opened this issue Jun 16, 2024 · 2 comments
Closed

process.chdir issue on Windows test run: EBUSY: Device or resource busy #11904

nobkd opened this issue Jun 16, 2024 · 2 comments
Assignees
Labels
bug Something isn't working windows An issue that is known to occur on Windows

Comments

@nobkd
Copy link

nobkd commented Jun 16, 2024

What version of Bun is running?

1.1.13+bd6a60512

What platform is your computer?

Microsoft Windows NT 10.0.19045.0 x64

What steps can reproduce the bug?

process.chdir() in a test on Windows to a directory (except node_modules, or directories starting with a dot, e.g. .dirname, maybe more, but those are the ones I found)

Minimal Reproduction (run twice or create _mytestdir by hand before running code once):

// minimal.test.js
import {test} from 'bun:test'
import {existsSync, mkdirSync} from 'node:fs'

const testdir = '_mytestdir'
if (!existsSync(testdir)) mkdirSync(testdir)

test('minimal test', () => {
	process.chdir(testdir)
})

Larger example: https://github.com/nobkd/bun-chdir-device-busy-repro (test run) (deleted)

What is the expected behavior?

bun test v1.1.13 (bd6a6051)

minimal.test.js:
 minimal test

 1 pass
 0 fail
Ran 1 tests across 1 files. [106.00ms]

What do you see instead?

bun test v1.1.13 (bd6a6051)

minimal.test.js:
3 |
4 | const testdir = 'mytestdir'
5 | if (!existsSync(testdir)) mkdirSync(testdir)
6 |
7 | test('minimal test', () => {
8 |     process.chdir(testdir)
             ^
EBUSY: Device or resource busy
   errno: -16
 syscall: "chdir"

      at C:\Users\nobkd\Desktop\bun-chdir-device-busy-repro\minimal.test.js:8:10
 minimal test

 0 pass
 1 fail
Ran 1 tests across 1 files. [121.00ms]

Additional information

  • Windows only issue
  • Test only issue

Note: This issue doesn't really block me, it's just something that I encountered by chance.

@nobkd nobkd added bug Something isn't working needs triage labels Jun 16, 2024
@paperclover paperclover added windows An issue that is known to occur on Windows and removed needs triage labels Jun 17, 2024
@paperclover paperclover self-assigned this Jun 17, 2024
@nobkd
Copy link
Author

nobkd commented Jul 5, 2024

I've tested this now with version v1.1.18 and this seems to be fixed.

Probably because of this:

Fixed: bun test directory open permissions on Windows

When searching for files to test on Windows, Bun was opening directories with the DELETE access mask which could cause spawned processes to fail to change their working directory.

I will check some other devices, and close this issue, if they work as well.

@nobkd
Copy link
Author

nobkd commented Jul 5, 2024

Really seems to be fixed. Thank you ❤️

@nobkd nobkd closed this as completed Jul 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working windows An issue that is known to occur on Windows
Projects
None yet
Development

No branches or pull requests

2 participants