use re_log_types::LogMsg;
use re_smart_channel::Sender;
pub fn load_stdin(tx: Sender<LogMsg>) -> anyhow::Result<()> {
let version_policy = re_log_encoding::decoder::VersionPolicy::Warn;
let stdin = std::io::BufReader::new(std::io::stdin());
let decoder = re_log_encoding::decoder::Decoder::new_concatenated(version_policy, stdin)?;
rayon::spawn(move || {
re_tracing::profile_scope!("stdin");
for msg in decoder {
let msg = match msg {
Ok(msg) => msg,
Err(err) => {
re_log::warn_once!("Failed to decode message in stdin: {err}");
continue;
}
};
if tx.send(msg).is_err() {
break; }
}
tx.quit(None).ok(); });
Ok(())
}