From b119cf19328615e1589728659f509a00d55c1bc4 Mon Sep 17 00:00:00 2001 From: Egor Tensin Date: Fri, 20 Nov 2020 03:44:01 +0300 Subject: show the faulty JSON from VsDevCmd.bat For some reason, VS 2017 started failing. I couldn't find why, it magically fixed itself when I started logging the JSON in case parsing fails. --- action.yml | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'action.yml') diff --git a/action.yml b/action.yml index ffc04bf..afadbf7 100644 --- a/action.yml +++ b/action.yml @@ -76,13 +76,16 @@ runs: throw "Couldn't find script '$script_name'" } - $json = $(& "${env:COMSPEC}" /s /c "`"$script_path`" -arch=${{ inputs.arch }} -no_logo && pwsh -Command `"Get-ChildItem env: | ConvertTo-Json`"") + $json = $(& "${env:COMSPEC}" /s /c "`"$script_path`" -arch=${{ inputs.arch }} -no_logo && pwsh -Command `"Get-ChildItem env: | Select-Object Name,Value | ConvertTo-Json`"") if ($LASTEXITCODE -ne 0) { throw $json } else { - $json | ConvertFrom-Json | %{ - $k, $v = $_.Key, $_.Value - Set-Content "env:$k" "$v" + try { + $json | ConvertFrom-Json | %{ Set-Content "env:$($_.Name)" $_.Value } + } catch { + echo 'There was a problem with the following JSON:' + echo $json + throw } } } -- cgit v1.2.3