diff --git a/Cargo.lock b/Cargo.lock index 710d05bb6abf..1360ad6ea639 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -653,17 +653,6 @@ dependencies = [ "zbus", ] -[[package]] -name = "atty" -version = "0.2.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" -dependencies = [ - "hermit-abi 0.1.19", - "libc", - "winapi", -] - [[package]] name = "autocfg" version = "1.1.0" @@ -2585,15 +2574,6 @@ version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" -[[package]] -name = "hermit-abi" -version = "0.1.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33" -dependencies = [ - "libc", -] - [[package]] name = "hermit-abi" version = "0.2.6" @@ -4905,7 +4885,6 @@ version = "0.12.0" dependencies = [ "ahash 0.8.6", "anyhow", - "atty", "crossbeam", "document-features", "itertools 0.12.0", diff --git a/Cargo.toml b/Cargo.toml index de91138bf861..fc65a1eccabb 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -104,7 +104,6 @@ array-init = "2.1" arrow2 = "0.17" arrow2_convert = "0.5.0" async-executor = "1.0" -atty = "0.2" backtrace = "0.3" bincode = "1.3" bitflags = { version = "2.4", features = ["bytemuck"] } diff --git a/crates/re_sdk/Cargo.toml b/crates/re_sdk/Cargo.toml index 0a1fbfc4caee..c3500f0b0ab3 100644 --- a/crates/re_sdk/Cargo.toml +++ b/crates/re_sdk/Cargo.toml @@ -52,7 +52,6 @@ re_sdk_comms = { workspace = true, features = ["client"] } re_types_core.workspace = true ahash.workspace = true -atty.workspace = true crossbeam.workspace = true document-features.workspace = true once_cell.workspace = true diff --git a/crates/re_sdk/src/recording_stream.rs b/crates/re_sdk/src/recording_stream.rs index 5427a67492c5..7a49c8865cdc 100644 --- a/crates/re_sdk/src/recording_stream.rs +++ b/crates/re_sdk/src/recording_stream.rs @@ -1,4 +1,5 @@ use std::fmt; +use std::io::IsTerminal; use std::sync::{atomic::AtomicI64, Arc}; use ahash::HashMap; @@ -37,6 +38,12 @@ fn forced_sink_path() -> Option { std::env::var(ENV_FORCE_SAVE).ok() } +/// Should we stream data to stdout when requested, or should we refrain because it's actually a +/// terminal? +fn is_stdout_listening() -> bool { + !std::io::stdout().is_terminal() +} + /// Errors that can occur when creating/manipulating a [`RecordingStream`]. #[derive(thiserror::Error, Debug)] pub enum RecordingStreamError { @@ -368,8 +375,7 @@ impl RecordingStreamBuilder { /// ``` #[cfg(not(target_arch = "wasm32"))] pub fn stdout(self) -> RecordingStreamResult { - let is_stdout_listening = !atty::is(atty::Stream::Stdout); - if !is_stdout_listening { + if !is_stdout_listening() { return self.buffered(); } @@ -1409,8 +1415,7 @@ impl RecordingStream { return Ok(()); } - let is_stdout_listening = !atty::is(atty::Stream::Stdout); - if !is_stdout_listening { + if !is_stdout_listening() { self.set_sink(Box::new(crate::log_sink::BufferedSink::new())); return Ok(()); }