From 1dba7f9343ac5bcb918e4bcd50e0761911c59412 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Olivares=20Gim=C3=A9nez?= Date: Thu, 22 Aug 2024 15:03:19 +0200 Subject: [PATCH] Check if the split produced a valid name and value, to ignore informative messages and empty lines (Bugfix for issue #50) --- packages/pico-setup-windows/pico-env.ps1 | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/pico-setup-windows/pico-env.ps1 b/packages/pico-setup-windows/pico-env.ps1 index 96df2c9..2f899ae 100644 --- a/packages/pico-setup-windows/pico-env.ps1 +++ b/packages/pico-setup-windows/pico-env.ps1 @@ -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 }