Repository navigation
Conversation
A task that `vp run` starts in another directory (`-r`, `pkg#task`, the `cwd` option, or a `cd` in its command) inherited the caller's `PWD`, so `PWD` and the real working directory disagreed. Replace an inherited `PWD` with the spawn's cwd, as a shell `cd` does. Fixes voidzero-dev#1049 Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
Fixes #1049.
vp runstarts a task in the task's directory, but the spawned process inherited the caller'sPWD. Withvp run -r,vp run pkg#task, a task'scwdoption, or acdin the command,PWDand the real working directory disagreed. Tools that compare the two complain: workerd printsPWD environment variable doesn't match current directoryonce per test file under@cloudflare/vitest-pluginwhen the tests run throughvp run -r test.Changes
plan_spawn_executionreplaces an inheritedPWDwith the spawn's cwd, as a shellcdorpnpm -r execdoes. It is applied beforeEnvFingerprints::resolve, so a task that listsPWDincache.envfingerprints the value it sees, and before prefix envs, soPWD=/x cmdstill wins.PWDis only replaced, never added, so environments that don't set it (such as most Windows shells) are unchanged.PWDis a default untracked env, so cache keys don't change.vp runis called from a symlinked path in the task's own directory,PWDis now the directoryvp runresolved (the physical path) rather than the caller's symlinked spelling.pwd_follows_task_cwdplan snapshot fixture:pkg#taskfrom the workspace root, thecwdoption,cdbefore the command, an uncached task, a prefix assignment, and a caller withoutPWD.