Skip to content

Commit

Permalink
Bug 1834673 - Part 1: Use UTF-8 in LCOV rewriter. r=firefox-build-sys…
Browse files Browse the repository at this point in the history
…tem-reviewers,nalexander

Differential Revision: https://phabricator.services.mozilla.com/D179051
  • Loading branch information
arai-a committed May 30, 2023
1 parent 65a97ad commit bd8f08e
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions python/mozbuild/mozbuild/codecoverage/lcov_rewriter.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ def iterate_records(self, rewrite_source=None):
current_pp_info = None
current_lines = []
for lcov_path in self.lcov_paths:
with open(lcov_path) as lcov_fh:
with open(lcov_path, "r", encoding="utf-8") as lcov_fh:
for line in lcov_fh:
line = line.rstrip()
if not line:
Expand Down Expand Up @@ -433,7 +433,7 @@ def __init__(self, chrome_map_path, appdir, gredir, extra_chrome_manifests):
self._final_mapping = {}

try:
with open(chrome_map_path) as fh:
with open(chrome_map_path, "r", encoding="utf-8") as fh:
url_prefixes, overrides, install_info, buildconfig = json.load(fh)
except IOError:
print(
Expand Down Expand Up @@ -692,14 +692,14 @@ def rewrite_source(url):

if output_file:
lcov_file = LcovFile(in_paths)
with open(output_file, "w+") as out_fh:
with open(output_file, "w+", encoding="utf-8") as out_fh:
lcov_file.print_file(
out_fh, rewrite_source, self.pp_rewriter.rewrite_record
)
else:
for in_path in in_paths:
lcov_file = LcovFile([in_path])
with open(in_path + output_suffix, "w+") as out_fh:
with open(in_path + output_suffix, "w+", encoding="utf-8") as out_fh:
lcov_file.print_file(
out_fh, rewrite_source, self.pp_rewriter.rewrite_record
)
Expand Down

0 comments on commit bd8f08e

Please sign in to comment.