Skip to content

Commit

Permalink
Explicitly close the output stream in SyslogLogger.
Browse files Browse the repository at this point in the history
Avoids relying on closing the stream through RAII, which acts worse in terms of error reporting in the presence of in-flight exceptions.
  • Loading branch information
s-ludwig committed Sep 10, 2024
1 parent 9b68d42 commit e871fbe
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion source/vibe/core/log.d
Original file line number Diff line number Diff line change
Expand Up @@ -833,7 +833,6 @@ final class SyslogLogger(StreamCallback) : Logger
@safe nothrow {
ubyte[4096] buf;


try {
auto ostr = m_streamCallback();

Expand All @@ -846,6 +845,8 @@ final class SyslogLogger(StreamCallback) : Logger
while (m_buffer.empty) {
if (m_buffer.capacity == 0) {
ostr.finalize();
static if (is(typeof(ostr.close())))
ostr.close();
return;
}
() @trusted { m_bufferCondition.wait(); } ();
Expand Down

0 comments on commit e871fbe

Please sign in to comment.