Skip to content

Commit

Permalink
Invoke close_write(error) if possible.
Browse files Browse the repository at this point in the history
  • Loading branch information
ioquatix committed Oct 28, 2024
1 parent 968ae4e commit e0b4782
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions lib/xrb/template.rb
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,16 @@ def to_buffer(scope)
def to_proc(scope = @binding.dup)
proc do |output|
to_string(scope, output)
rescue => error
raise
ensure
if output.respond_to?(:close_write)
if output.method(:close_write).arity == 1
output.close_write(error)
else
output.close_write
end
end
end
end

Expand Down

0 comments on commit e0b4782

Please sign in to comment.