From c80d18bb66aa6977b413f3bd9350c0957cb5f887 Mon Sep 17 00:00:00 2001 From: Clement Rey Date: Wed, 13 Dec 2023 15:58:24 +0100 Subject: [PATCH] mention the atty business --- crates/re_sdk/src/recording_stream.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/crates/re_sdk/src/recording_stream.rs b/crates/re_sdk/src/recording_stream.rs index 7562b6bab4c6..69e4c70f64a6 100644 --- a/crates/re_sdk/src/recording_stream.rs +++ b/crates/re_sdk/src/recording_stream.rs @@ -356,6 +356,9 @@ impl RecordingStreamBuilder { /// Creates a new [`RecordingStream`] that is pre-configured to stream the data through to stdout. /// + /// If there isn't any listener at the other end of the pipe, the [`RecordingStream`] will + /// default back to `buffered` mode, in order not to break the user's terminal. + /// /// ## Example /// /// ```no_run @@ -1341,6 +1344,9 @@ impl RecordingStream { /// Swaps the underlying sink for a [`crate::sink::FileSink`] pointed at stdout. /// + /// If there isn't any listener at the other end of the pipe, the [`RecordingStream`] will + /// default back to `buffered` mode, in order not to break the user's terminal. + /// /// This is a convenience wrapper for [`Self::set_sink`] that upholds the same guarantees in /// terms of data durability and ordering. /// See [`Self::set_sink`] for more information. @@ -1352,6 +1358,7 @@ impl RecordingStream { let is_stdout_listening = !atty::is(atty::Stream::Stdout); if !is_stdout_listening { + self.set_sink(Box::new(crate::log_sink::BufferedSink::new())); return Ok(()); }