fix(install.ps1): update $env:PATH in current session so refuse runs immediately#47
Merged
Merged
Conversation
…immediately Same UX bug the Linux install.sh fix in #46 addresses, on Windows: the script writes the user-scope PATH via SetEnvironmentVariable but the current PowerShell session keeps its old $env:PATH, so the very next command the script suggests (`refuse --version` / `refuse init`) fails with "The term 'refuse' is not recognized". Fix: after the registry write, also prepend the install dir to $env:PATH in the running session (idempotent — skip if already present). Update the trailing message to drop the "open a new terminal" instruction since the caller's session now has refuse on PATH directly. Works because `irm | iex` runs in the caller's scope; $env:PATH mutations in the piped script propagate to the user's prompt.
4 tasks
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.
Repro
Fresh Windows box, follow the docs:
The script's own "next step" fails because the persistent user PATH is updated but the current session's
$env:PATHis not.Fix
After the existing
[Environment]::SetEnvironmentVariable("PATH", ..., "User")call, also mutate$env:PATHin the running session (idempotent). Update the trailing message to drop the "open a new terminal" instruction.Works because
irm | iexruns in the caller's scope;$env:PATHwrites in the piped script propagate to the user's prompt.Pairs with #46
Sibling fix for the same shape of bug on Linux/macOS — the
scripts/install.shcompanion in #46.Test plan
irm | iex→ confirmrefuse --versionworks without opening a new terminal.$env:PATHis not double-prepended.