Skip to content

Fix PowerShell PATH env output - #1572

Open
LingyeNBird wants to merge 1 commit into
Schniz:masterfrom
LingyeNBird:fix-powershell-path-runtime
Open

Fix PowerShell PATH env output#1572
LingyeNBird wants to merge 1 commit into
Schniz:masterfrom
LingyeNBird:fix-powershell-path-runtime

Conversation

@LingyeNBird

@LingyeNBird LingyeNBird commented Jun 28, 2026

Copy link
Copy Markdown

Summary

  • Change PowerShell env output to prepend fnm's multishell path to $env:PATH at evaluation time.
  • Avoid embedding the PATH value captured when fnm env --shell powershell is generated.
  • Add a patch changeset.

Problem

PowerShell currently receives a fully expanded PATH assignment from fnm env. If a user copies the generated output into their PowerShell profile, that profile keeps a stale PATH snapshot. Later system or user PATH updates, such as installers adding new directories, are not picked up by that static snippet.

The documented setup pipes fnm env into Invoke-Expression, but using a runtime $env:PATH reference makes the generated PowerShell snippet safer and consistent with the shell evaluating the current PATH when the snippet runs.

Fix

Instead of generating:

$env:PATH = "<fnm-path>;<captured PATH>"

PowerShell now generates:

$env:PATH = "<fnm-path>;$env:PATH"

This keeps fnm's path first while preserving the current PowerShell PATH at evaluation time.

Verification

  • Verified the generated PowerShell assignment expands $env:PATH at evaluation time, including through Out-String | Invoke-Expression.
  • Ran cargo fmt --check.
  • Ran git diff --check.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant