E406 [Bug] option -TargetEnvVar ignored for the current session environment · Issue #6579 · ScoopInstaller/Scoop · GitHub
[go: up one dir, main page]

Skip to content

[Bug] option -TargetEnvVar ignored for the current session environment #6579

@xworld21

Description

@xworld21

Bug Report

When using Add-Path -TargetEnvVar, the current session environment is not updated correctly.

Current Behavior

The new path is added to the user profile, or to the system, in the requested target variable, but it is also added to the session PATH instead of the session target variable.

Expected Behavior

The target variable should be updated instead of PATH.

Possible Solution

Replace the hardcoded PATH with the value of $TargetEnvVar:

Scoop/lib/system.ps1

Lines 115 to 119 in b588a06

# current session
$inPath, $strippedPath = Split-PathLikeEnvVar $Path $env:PATH
if (!$inPath -or $Force) {
$env:PATH = (@($Path) + $strippedPath) -join ';'
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0