SIGN IN SIGN UP
denoland / deno UNCLAIMED

A modern runtime for JavaScript and TypeScript.

0 0 30 Rust

fix(compile): allow process.chdir() into the VFS (#34610)

Compiled executables embed their source files in a virtual file system
rooted at a temp directory, so `import.meta.url` and `__dirname` point
inside the VFS. `chdir()` unconditionally returned `NotSupported` for
any path within the VFS, which crashed programs that change into their
own directory on startup. Next.js standalone builds are the common case:
their bootstrap script calls `process.chdir(__dirname)` before doing
anything else, so they could never run when compiled.

The process working directory genuinely can't be moved onto a virtual
path, but the call doesn't need to fail. This treats a `chdir` into a
VFS directory as a no-op, returns `NotADirectory` when the target is a
file and `NotFound` when it doesn't exist, so the startup sequence
proceeds instead of throwing. `Deno.cwd()` still reports the previous
(real) working directory.

Fixes #26175
B
Bartek Iwańczuk committed
91c5e7b69251aa785a116e96ce236b2e570d5835
Parent: 4384685
Committed by GitHub <noreply@github.com> on 6/1/2026, 11:46:24 AM