From 8d2536409e4571c255e10d120e2c1108829b18fe Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Wed, 24 Feb 2021 23:57:40 +0000 Subject: [PATCH] tests: fetch sse and set up a thing we can read Signed-off-by: Ian Jackson --- apitest/at-otter.rs | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) 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); } } -- 2.30.2