Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions packages/cli/install.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -178,9 +178,13 @@ function Configure-UserPath {
}

$newPath = "$binPath;$userPath"
[Environment]::SetEnvironmentVariable("Path", $newPath, "User")
$env:Path = "$binPath;$env:Path"
return "true"
try {
[Environment]::SetEnvironmentVariable("Path", $newPath, "User")
$env:Path = "$binPath;$env:Path"
return "true"
} catch {
Write-Error-Exit "Cannot update user PATH. Please check your system permissions and re-run the installer."
}
}

# Run vp env setup --refresh, showing output only on failure
Expand Down
3 changes: 3 additions & 0 deletions packages/cli/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,9 @@ add_bin_to_path() {
ref_pattern=$(printf '%s' "$INSTALL_DIR_REF" | sed 's/[.[\*^$()+?{|]/\\&/g')

if [ -f "$shell_config" ]; then
if [ ! -w "$shell_config" ]; then
error "Cannot write to $shell_config. Please check the file permissions and re-run the installer."
Comment thread
fengmk2 marked this conversation as resolved.
Outdated
fi
if grep -q "${abs_pattern}/env" "$shell_config" 2>/dev/null || \
grep -q "${ref_pattern}/env" "$shell_config" 2>/dev/null; then
return 2
Expand Down
Loading