From 577d0a0053441c285e23ee255fd59cf6e6f323a9 Mon Sep 17 00:00:00 2001 From: Luke Curley Date: Mon, 5 Oct 2026 23:36:58 -0700 Subject: [PATCH] test(moq-tokio): the max-age JS publisher's ready line follows its connect logs #4876 dropped JS dev mode, so @moq/net's connect logs now always print, and Bun writes console.debug to stdout ahead of the client's ready line. Skip to it, fail if the client exits first, and drain the rest so a later log can't hit a closed pipe. NODE_ENV=production silenced nothing anymore. Co-Authored-By: Claude Opus 5.5 --- rs/moq-tokio/tests/max_age.rs | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/rs/moq-tokio/tests/max_age.rs b/rs/moq-tokio/tests/max_age.rs index 968f625e89..71ce8cf70a 100644 --- a/rs/moq-tokio/tests/max_age.rs +++ b/rs/moq-tokio/tests/max_age.rs @@ -65,7 +65,6 @@ async fn relay(version: moq_net::Version, javascript: Option) -> anyhow::R let mut child = if let Some(publish) = javascript { let script = std::path::Path::new(env!("CARGO_MANIFEST_DIR")).join("../../test/max-age/client.ts"); let mut child = tokio::process::Command::new("bun") - .env("NODE_ENV", "production") .arg(script) .arg(url.as_str()) .arg(version.alpn()) @@ -76,11 +75,16 @@ async fn relay(version: moq_net::Version, javascript: Option) -> anyhow::R .kill_on_drop(true) .spawn()?; if publish { - let mut line = String::new(); - BufReader::new(child.stdout.take().unwrap()) - .read_line(&mut line) - .await?; - anyhow::ensure!(line.trim() == "ready", "JS publisher did not become ready: {line}"); + // @moq/net's connection logs share stdout with the readiness line, before and after it. + let mut lines = BufReader::new(child.stdout.take().unwrap()).lines(); + loop { + let line = lines.next_line().await?; + anyhow::ensure!(line.is_some(), "JS publisher exited before ready"); + if line.as_deref() == Some("ready") { + break; + } + } + tokio::spawn(async move { while let Ok(Some(_)) = lines.next_line().await {} }); } Some(child) } else {