Skip to content

Commit b82cc48

Browse files
mcollinaclaude
andcommitted
doc: clarify virtualCwd behavior in Worker threads
Virtual cwd works for virtual paths in Workers, but process.chdir() to real filesystem paths will throw ERR_WORKER_UNSUPPORTED_OPERATION. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 2fff415 commit b82cc48

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

doc/api/vfs.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -263,9 +263,9 @@ the VFS when `virtualCwd` is enabled in the constructor options.
263263
Throws `ERR_INVALID_STATE` if `virtualCwd` was not enabled during construction.
264264

265265
When mounted with `virtualCwd` enabled, the VFS also hooks `process.chdir()` and
266-
`process.cwd()` to support virtual paths transparently. Since `process.chdir()`
267-
is not available in Worker threads, virtual cwd should only be used in the main
268-
thread.
266+
`process.cwd()` to support virtual paths transparently. In Worker threads,
267+
`process.chdir()` to virtual paths will work, but attempting to change to real
268+
filesystem paths will throw `ERR_WORKER_UNSUPPORTED_OPERATION`.
269269

270270
### `vfs.cwd()`
271271

0 commit comments

Comments
 (0)