Skip to content

Commit

Permalink
read from stdin if - is specified
Browse files Browse the repository at this point in the history
  • Loading branch information
teh-cmc committed Dec 14, 2023
1 parent 9c7edb9 commit 634f7ff
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ 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"] }
Expand Down
10 changes: 10 additions & 0 deletions crates/re_data_source/src/data_source.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,16 @@ impl DataSource {
}
}

// Reading from standard input in non-TTY environments (e.g. GitHub Actions, but I'm sure we can
// come up with more convoluted than that…) can lead to many unexpected,
// platform-specific problems that aren't even necessarily consistent across runs.
//
// In order to avoid having to swallow errors based on unreliable heuristics (or inversely:
// throwing errors when we shouldn't), we just make reading from standard input explicit.
if uri == "-" {
return DataSource::Stdin;
}

let path = std::path::Path::new(&uri).to_path_buf();

if uri.starts_with("file://") || path.exists() {
Expand Down
1 change: 1 addition & 0 deletions crates/rerun/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ pub mod external {
pub use anyhow;

pub use re_build_info;
pub use re_data_source;
pub use re_data_store;
pub use re_data_store::external::*;
pub use re_format;
Expand Down

0 comments on commit 634f7ff

Please sign in to comment.