diff options
author | Egor Tensin <Egor.Tensin@gmail.com> | 2020-11-20 03:44:01 +0300 |
---|---|---|
committer | Egor Tensin <Egor.Tensin@gmail.com> | 2020-11-20 03:52:24 +0300 |
commit | b119cf19328615e1589728659f509a00d55c1bc4 (patch) | |
tree | 80b86ed307954a21033c03696a68515cc7819317 | |
parent | README: update (diff) | |
download | vs-shell-b119cf19328615e1589728659f509a00d55c1bc4.tar.gz vs-shell-b119cf19328615e1589728659f509a00d55c1bc4.zip |
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.
-rw-r--r-- | action.yml | 11 |
1 files changed, 7 insertions, 4 deletions
@@ -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 } } } |