Skip to content

$env:Path is mangled in Windows install.ps1 #16811

@mattcargile

Description

@mattcargile

What version of Bun is running?

1.2.0+b0c5a7655

What platform is your computer?

Microsoft Windows NT 10.0.22631.0 x64

What steps can reproduce the bug?

irm bun.sh/install.ps1 | iex

What is the expected behavior?

I expect my $env:Path to maintain the semicolons.

What do you see instead?

My $env:Path is space delimited.

Additional information

Line to the code. $Path is -split so when you reset it, it removes the ;.

bun/src/cli/install.ps1

Lines 293 to 302 in ce53290

$Path = (Get-Env -Key "Path") -split ';'
if ($Path -notcontains $BunBin) {
if (-not $NoPathUpdate) {
$Path += $BunBin
Write-Env -Key 'Path' -Value ($Path -join ';')
$env:PATH = $Path;
} else {
Write-Output "Skipping adding '${BunBin}' to the user's %PATH%`n"
}
}

This mainly breaks folks who don't shell out to powershell and run irm bun.sh/install.ps1 | iex directly inside an already open pwsh.exe or powershell.exe shell. So you would either remove the $env:Path redefinition or handle the $env:Path differently. And the below write-output could mean different things depending on how the irm | iex is run assuming you are willing to fix the $env:Path redefinition.

Write-Output "To get started, restart your terminal/editor, then type `"bun`"`n"

Metadata

Metadata

Assignees

Labels

bugSomething isn't workinggood first issueSomething that would be good for new contributorswindowsAn issue that is known to occur on Windows

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions