Use UTF-8 without a BOM for win coverage (#66510)

This commit is contained in:
Jordan Borean 2020-01-16 09:52:05 +10:00 committed by GitHub
parent 3bcb664497
commit e459eac565
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 1 deletions

View File

@ -0,0 +1,2 @@
bugfixes:
- ansible-test windows coverage - Ensure coverage reports are UTF-8 encoded without a BOM

View File

@ -176,7 +176,9 @@ try {
$code_cov_json = ConvertTo-Json -InputObject $coverage_info -Compress
Write-AnsibleLog "INFO - Outputting coverage json to '$coverage_output_path'" "coverage_wrapper"
Set-Content -LiteralPath $coverage_output_path -Value $code_cov_json -Encoding $file_encoding
# Ansible controller expects these files to be UTF-8 without a BOM, use .NET for this.
$utf8_no_bom = New-Object -TypeName System.Text.UTF8Encoding -ArgumentList $false
[System.IO.File]::WriteAllbytes($coverage_output_path, $utf8_no_bom.GetBytes($code_cov_json))
}
} finally {
try {