From: Ian Jackson Date: Wed, 24 Feb 2021 23:57:40 +0000 (+0000) Subject: tests: fetch sse and set up a thing we can read X-Git-Tag: otter-0.4.0~370 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=8d2536409e4571c255e10d120e2c1108829b18fe;p=otter.git tests: fetch sse and set up a thing we can read Signed-off-by: Ian Jackson --- diff --git a/apitest/at-otter.rs b/apitest/at-otter.rs index 98e5bb55..9ba4a7eb 100644 --- a/apitest/at-otter.rs +++ b/apitest/at-otter.rs @@ -61,14 +61,26 @@ impl Ctx { .parse().unwrap()); dbg!(gen); - let sse = client.get( + let mut sse = client.get( &self.ds .also(&[("ctoken", ctoken), ("gen", &gen.to_string())]) .subst("@url@/_/updates?ctoken=@ctoken@&gen=@gen@")? ).send()?; - //sse.copy_to(&mut std::io::stderr())?; + let (mut writer, mut reader) = std::os::unix::net::UnixStream::pair()?; + thread::spawn(move ||{ + eprintln!("copy_to'ing"); + sse.copy_to(&mut writer).unwrap(); + eprintln!("copy_to'd!"); + }); + thread::spawn(move ||{ + eprintln!("copying"); + std::io::copy(&mut reader, &mut std::io::stderr()).unwrap(); + eprintln!("copied!"); + }); + + sleep(10 * MS); } }