Skip to content

Commit

Permalink
Fix double flushing json/yaml builders (#10716)
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewmcgarvey authored May 21, 2021
1 parent 60d227c commit 4af98d4
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
3 changes: 1 addition & 2 deletions src/json/builder.cr
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class JSON::Builder
when DocumentEndState
# okay
end
@io.flush
flush
end

def document
Expand Down Expand Up @@ -415,6 +415,5 @@ module JSON
builder.document do
yield builder
end
io.flush
end
end
3 changes: 1 addition & 2 deletions src/yaml/builder.cr
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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.
Expand Down

0 comments on commit 4af98d4

Please sign in to comment.