Skip to content

Commit

Permalink
Disable default behavior of frozen_string_literal for Ruby 3.4+
Browse files Browse the repository at this point in the history
According to https://bugs.ruby-lang.org/issues/20205,
it will enable `# frozen_string_literal: true` by default in the future Ruby.

This changing will affect many Fluentd plugins, and they will require to be deal with it properly.
But I think it is too tough.

So, this patch will set `--disable=frozen_string_literal` as launch option to disable default behavior for `# frozen_string_literal: true` in future Ruby.

GitHub: fluentGH-4585
Signed-off-by: Watson <[email protected]>
  • Loading branch information
Watson1978 committed Aug 9, 2024
1 parent 5618dd0 commit 9f4c9dc
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ Rake::TestTask.new(:base_test) do |t|
end
t.verbose = true
t.warning = true
t.ruby_opts = ["-Eascii-8bit:ascii-8bit"]
t.ruby_opts = ["-Eascii-8bit:ascii-8bit --disable=frozen_string_literal"]
end

task :parallel_test do
Expand Down
2 changes: 2 additions & 0 deletions lib/fluent/supervisor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1019,6 +1019,8 @@ def build_spawn_command
fluentd_spawn_cmd = [ServerEngine.ruby_bin_path]
end

fluentd_spawn_cmd << '--disable=frozen_string_literal'

rubyopt = ENV['RUBYOPT']
if rubyopt
encodes, others = rubyopt.split(' ').partition { |e| e.match?(RUBY_ENCODING_OPTIONS_REGEX) }
Expand Down

0 comments on commit 9f4c9dc

Please sign in to comment.