Skip to content

Commit 746abf4

Browse files
chore: force utf-8 locale via RUBYOPT when formatting
1 parent c4ef024 commit 746abf4

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Rakefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ multitask(:test) do
3636
end
3737

3838
xargs = %w[xargs --no-run-if-empty --null --max-procs=0 --max-args=300 --]
39-
locale = {"LC_ALL" => "C.UTF-8"}
39+
ruby_opt = {"RUBYOPT" => [ENV["RUBYOPT"], "--encoding=UTF-8"].compact.join(" ")}
4040

4141
desc("Lint `*.rb(i)`")
4242
multitask(:"lint:rubocop") do
@@ -64,7 +64,7 @@ desc("Format `*.rbi`")
6464
multitask(:"format:rbi") do
6565
find = %w[find ./rbi -type f -and -name *.rbi -print0]
6666
fmt = xargs + %w[stree write --]
67-
sh(locale, "#{find.shelljoin} | #{fmt.shelljoin}")
67+
sh(ruby_opt, "#{find.shelljoin} | #{fmt.shelljoin}")
6868
end
6969

7070
desc("Format `*.rbs`")
@@ -100,7 +100,7 @@ multitask(:"format:rbs") do
100100
# transform class aliases to type aliases, which syntax tree has no trouble with
101101
sh("#{find.shelljoin} | #{pre.shelljoin}")
102102
# run syntax tree to format `*.rbs` files
103-
sh(locale, "#{find.shelljoin} | #{fmt.shelljoin}") do
103+
sh(ruby_opt, "#{find.shelljoin} | #{fmt.shelljoin}") do
104104
success = _1
105105
end
106106
# transform type aliases back to class aliases

0 commit comments

Comments
 (0)