summaryrefslogtreecommitdiff
path: root/source/core/slang-std-writers.h
diff options
context:
space:
mode:
authorjsmall-nvidia <jsmall@nvidia.com>2022-07-01 14:02:28 -0400
committerGitHub <noreply@github.com>2022-07-01 11:02:28 -0700
commitb0ea5ed4da709312910898fa03b4dafc7a27e358 (patch)
tree70adea35a369d43bea79d71dcb2f8758772562aa /source/core/slang-std-writers.h
parent65cd44d54cc76d78777cde5f8a02b485056249f3 (diff)
Fix for issue with redirecting stdout/err to a file (#2311)
Diffstat (limited to 'source/core/slang-std-writers.h')
-rw-r--r--source/core/slang-std-writers.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/source/core/slang-std-writers.h b/source/core/slang-std-writers.h
index d193bfe0c..84447186a 100644
--- a/source/core/slang-std-writers.h
+++ b/source/core/slang-std-writers.h
@@ -15,6 +15,9 @@ public:
ISlangWriter* getWriter(SlangWriterChannel chan) const { return m_writers[chan]; }
void setWriter(SlangWriterChannel chan, ISlangWriter* writer) { m_writers[chan] = writer; }
+ /// Flush all the set writers
+ void flushWriters();
+
/// Ctor
StdWriters() {}
@@ -36,6 +39,19 @@ protected:
static StdWriters* s_singleton;
};
+// --------------------------------------------------------------------------
+inline void StdWriters::flushWriters()
+{
+ for (Index i = 0; i < Count(SLANG_WRITER_CHANNEL_COUNT_OF); ++i)
+ {
+ auto writer = m_writers[i];
+ if (writer)
+ {
+ writer->flush();
+ }
+ }
+}
+
}
#endif