From 3e396b3782813d36d46195564cd0e111422bcaf5 Mon Sep 17 00:00:00 2001 From: Daniel Mensinger Date: Tue, 22 Jun 2021 22:59:16 +0200 Subject: fix: Always explicitly set encoding for text files (fixes #8263) --- mesonbuild/scripts/coverage.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'mesonbuild/scripts/coverage.py') diff --git a/mesonbuild/scripts/coverage.py b/mesonbuild/scripts/coverage.py index f8a4924..b60d5d1 100644 --- a/mesonbuild/scripts/coverage.py +++ b/mesonbuild/scripts/coverage.py @@ -68,11 +68,11 @@ def coverage(outputs: T.List[str], source_root: str, subproject_root: str, build # Create a shim to allow using llvm-cov as a gcov tool. if mesonlib.is_windows(): llvm_cov_shim_path = os.path.join(log_dir, 'llvm-cov.bat') - with open(llvm_cov_shim_path, 'w') as llvm_cov_bat: + with open(llvm_cov_shim_path, 'w', encoding='utf-8') as llvm_cov_bat: llvm_cov_bat.write(f'@"{llvm_cov_exe}" gcov %*') else: llvm_cov_shim_path = os.path.join(log_dir, 'llvm-cov.sh') - with open(llvm_cov_shim_path, 'w') as llvm_cov_sh: + with open(llvm_cov_shim_path, 'w', encoding='utf-8') as llvm_cov_sh: llvm_cov_sh.write(f'#!/usr/bin/env sh\nexec "{llvm_cov_exe}" gcov $@') os.chmod(llvm_cov_shim_path, os.stat(llvm_cov_shim_path).st_mode | stat.S_IEXEC) gcov_tool_args = ['--gcov-tool', llvm_cov_shim_path] -- cgit v1.1