aboutsummaryrefslogtreecommitdiff
path: root/libbuild2
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2022-11-02 15:00:13 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2022-11-08 11:08:03 +0200
commit94fb1117dd8c32dd4732b792300f1b6b3cb6af8f (patch)
tree2dc2297087cebe8892e606d204663ae5bd634ffd /libbuild2
parentf7f22db6030464f63eb942da04b3d5e10351f770 (diff)
Add diag_buffer::is_open()
Diffstat (limited to 'libbuild2')
-rw-r--r--libbuild2/diagnostics.hxx12
1 files changed, 12 insertions, 0 deletions
diff --git a/libbuild2/diagnostics.hxx b/libbuild2/diagnostics.hxx
index 1659a09..e619f86 100644
--- a/libbuild2/diagnostics.hxx
+++ b/libbuild2/diagnostics.hxx
@@ -71,6 +71,18 @@ namespace build2
bool force = false,
fdstream_mode mode = fdstream_mode::skip);
+ // Check whether the buffer has been opened with the open() call and
+ // hasn't yet been closed.
+ //
+ // Note that this function returning true does not mean that the pipe was
+ // opened (to check that, call is_open() on the `is` member below).
+ //
+ bool
+ is_open () const
+ {
+ return state_ != state::closed;
+ }
+
// Read the diagnostics from the parent end of the pipe if one was opened
// and buffer/stream it as necessary. Return true if there could be more
// diagnostics to read (only possible in the non-blocking mode).