Skip to content

Commit

Permalink
mention the atty business
Browse files Browse the repository at this point in the history
  • Loading branch information
teh-cmc committed Dec 14, 2023
1 parent fa30edc commit 6d8f7b0
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions crates/re_sdk/src/recording_stream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -1354,6 +1357,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.
Expand All @@ -1365,6 +1371,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(());
}

Expand Down

0 comments on commit 6d8f7b0

Please sign in to comment.