From fba358dff9656598300a0c79818b11c2c369b5ee Mon Sep 17 00:00:00 2001 From: matthewmcgarvey Date: Sat, 15 May 2021 12:09:16 -0400 Subject: [PATCH] Fix double flushing json/yaml builders --- src/json/builder.cr | 3 +-- src/yaml/builder.cr | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/json/builder.cr b/src/json/builder.cr index d848d954bc4e..49af4b7bdb6d 100644 --- a/src/json/builder.cr +++ b/src/json/builder.cr @@ -53,7 +53,7 @@ class JSON::Builder when DocumentEndState # okay end - @io.flush + flush end def document @@ -415,6 +415,5 @@ module JSON builder.document do yield builder end - io.flush end end diff --git a/src/yaml/builder.cr b/src/yaml/builder.cr index 77924f184809..1e96dd5142a8 100644 --- a/src/yaml/builder.cr +++ b/src/yaml/builder.cr @@ -53,7 +53,6 @@ class YAML::Builder def self.build(io : IO, & : self ->) : Nil builder = new(io) yield builder ensure builder.close - io.flush end # Starts a YAML stream. @@ -64,7 +63,7 @@ class YAML::Builder # Ends a YAML stream. def end_stream emit stream_end - @io.flush + flush end # Starts a YAML stream, invokes the block, and ends it.