Skip to content

Commit

Permalink
StringIO#write accepts multiple args in ruby 2.5
Browse files Browse the repository at this point in the history
As of this commit, which landed in ruby 2.5.0, both IO and StringIO
write now accept multiple arguments:
ruby/ruby@aeaeb4b

Somehow this was causing the automation engine spec, specifically, the
"writes to the logger synchronously" example to spin at 100% cpu,
perhaps because write was failing with argument errors.

Seen originally in:
ManageIQ/manageiq-automation_engine#296
  • Loading branch information
jrafanie committed Feb 21, 2019
1 parent 2665784 commit 16469d6
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions lib/vmdb/loggers/io_logger.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,12 @@ def initialize(logger, level = :info, prefix = nil)
super()
end

def write(string)
@buffer ||= ""
@buffer << string
dump_buffer if string.include?("\n")
def write(*args)
args.each do |arg|
@buffer ||= ""
@buffer << arg
dump_buffer if arg.include?("\n")
end
end

def <<(string)
Expand Down

0 comments on commit 16469d6

Please sign in to comment.