Skip to content
This repository was archived by the owner on Sep 30, 2024. It is now read-only.

Validate output of pico-env.cmd before setting env. variables #51

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all 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
6 changes: 5 additions & 1 deletion packages/pico-setup-windows/pico-env.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@ $ProgressPreference = 'SilentlyContinue'
# https://github.com/microsoft/vswhere/wiki/Start-Developer-Command-Prompt#using-powershell
& "${env:COMSPEC}" /s /c "`"$PSScriptRoot\pico-env.cmd`" && set" | ForEach-Object {
$name, $value = $_ -split '=', 2
Set-Content env:\"$name" $value

# Check if the split produced a valid name and value, to ignore informative messages and empty lines
if (-not [string]::IsNullOrEmpty($name) -and -not [string]::IsNullOrEmpty($value)) {
Set-Content env:\"$name" $value
}
}

Get-ChildItem env:PICO_*, env:OPENOCD_* | ForEach-Object { '{0}={1}' -f $_.Name, $_.Value }