Commit 7f81c7a
fix: preserve PATHEXT for Windows cached tasks (#366)
Fixes #365.
Preserves PATHEXT in the default Windows environment passthrough so
PowerShell package shims can resolve node.exe during cached task
execution.
<details>
<summary>Why PATHEXT is required</summary>
In the issue repro, `marker-cli` is exposed through a pnpm-generated
`node_modules/.bin/marker-cli.ps1` shim. On Windows, that shim sets
`$exe = ".exe"` and then falls back to invoking Node by name:
```powershell
& "node$exe" "$basedir/../marker-cli/bin/marker-cli.mjs" $args
```
So the actual command is `& "node.exe" ...`.
When `PATHEXT` is missing from the sanitized cached-task environment,
PowerShell can still locate `node.exe` with `Get-Command node.exe`, but
native invocation by name does not run correctly: `& "node.exe"
--version` produces no output, `$LASTEXITCODE` is unset, and the repro
marker file is not created. Restoring `PATHEXT` with `.EXE` makes the
same shim execute normally and create the marker.
This is why preserving `PATHEXT` fixes the cached PowerShell shim path
without changing fspy or the shim rewrite itself.
</details>
Verified with the issue repro on Windows, `cargo fmt --check`, `cargo
build -p vite_task_bin`, and `cargo test -p vite_task_plan --test
plan_snapshots -- windows_cmd_shim_rewrite`.
---------
Co-authored-by: SegaraRai <29276700+SegaraRai@users.noreply.github.com>
Co-authored-by: branchseer <dk4rest@gmail.com>
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 88bacaa commit 7f81c7a
9 files changed
Lines changed: 74 additions & 0 deletions
File tree
- crates
- vite_task_bin/tests/e2e_snapshots/fixtures/windows_powershell_shim_pathext
- node_modules/.bin
- snapshots
- vite_task_graph/src/config
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
| 3 | + | |
3 | 4 | | |
4 | 5 | | |
5 | 6 | | |
| |||
Lines changed: 3 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
Lines changed: 4 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 4 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 3 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
Lines changed: 23 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
Lines changed: 25 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
Lines changed: 10 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
382 | 382 | | |
383 | 383 | | |
384 | 384 | | |
| 385 | + | |
385 | 386 | | |
386 | 387 | | |
387 | 388 | | |
| |||
0 commit comments