From cc9337a5877b0164e97f30ba4814aff906f01c4e Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Mon, 7 Nov 2022 06:53:00 +0200 Subject: Add diag_buffer::open_eof() --- libbuild2/diagnostics.cxx | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'libbuild2/diagnostics.cxx') diff --git a/libbuild2/diagnostics.cxx b/libbuild2/diagnostics.cxx index 21e3345..01bd43f 100644 --- a/libbuild2/diagnostics.cxx +++ b/libbuild2/diagnostics.cxx @@ -141,7 +141,7 @@ namespace build2 const fail_mark fail ("error"); const fail_end endf; - // diag_buffer + // diag_buffer // process::pipe diag_buffer:: open (const char* args0, bool force, fdstream_mode m) @@ -180,6 +180,17 @@ namespace build2 return r; } + void diag_buffer:: + open_eof (const char* args0) + { + assert (state_ == state::closed && args0 != nullptr); + + serial = ctx_.sched.serial (); + nobuf = !serial && ctx_.no_diag_buffer; + this->args0 = args0; + state_ = state::eof; + } + bool diag_buffer:: read (bool force) { @@ -303,6 +314,8 @@ namespace build2 void diag_buffer:: write (const string& s, bool nl, bool force) { + assert (state_ != state::closed); + // Similar logic to read() above. // if ((serial || nobuf) && !force) -- cgit v1.1