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

pull/66300/head
Jordan Borean 5 years ago committed by GitHub
parent 3bcb664497
commit e459eac565
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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

@ -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 {

Loading…
Cancel
Save