deno
91c5e7b6 - fix(compile): allow process.chdir() into the VFS (#34610)

Commit
52 days ago
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
Author
Parents
Loading