diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2022-11-02 15:00:13 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2022-11-08 11:08:03 +0200 |
commit | 94fb1117dd8c32dd4732b792300f1b6b3cb6af8f (patch) | |
tree | 2dc2297087cebe8892e606d204663ae5bd634ffd | |
parent | f7f22db6030464f63eb942da04b3d5e10351f770 (diff) |
Add diag_buffer::is_open()
-rw-r--r-- | libbuild2/diagnostics.hxx | 12 |
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). |