diff options
| author | bors <bors@rust-lang.org> | 2020-10-27 11:43:18 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2020-10-27 11:43:18 +0000 |
| commit | 56d288fa46e04cd5faf53d369a1a640a97e2bb08 (patch) | |
| tree | c2f7e816a443a91a45a9038ce7ecc46ede60f97c /library/test/src | |
| parent | 20b1e05a8d0e1773dc840a3286aa37916e87d84b (diff) | |
| parent | 7c4fe002131f1160f2054885ab40c74464951a64 (diff) | |
| download | rust-56d288fa46e04cd5faf53d369a1a640a97e2bb08.tar.gz rust-56d288fa46e04cd5faf53d369a1a640a97e2bb08.zip | |
Auto merge of #78227 - SergioBenitez:test-stdout-threading, r=m-ou-se
Capture output from threads spawned in tests This is revival of #75172. Original text: > Fixes #42474. > > r? `@​dtolnay` since you expressed interest in this, but feel free to redirect if you aren't the right person anymore. --- Closes #75172.
Diffstat (limited to 'library/test/src')
| -rw-r--r-- | library/test/src/helpers/sink.rs | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/library/test/src/helpers/sink.rs b/library/test/src/helpers/sink.rs index aa7fe248773..dfbf0a3b72f 100644 --- a/library/test/src/helpers/sink.rs +++ b/library/test/src/helpers/sink.rs @@ -6,6 +6,7 @@ use std::{ sync::{Arc, Mutex}, }; +#[derive(Clone)] pub struct Sink(Arc<Mutex<Vec<u8>>>); impl Sink { @@ -14,6 +15,12 @@ impl Sink { } } +impl io::LocalOutput for Sink { + fn clone_box(&self) -> Box<dyn io::LocalOutput> { + Box::new(self.clone()) + } +} + impl Write for Sink { fn write(&mut self, data: &[u8]) -> io::Result<usize> { Write::write(&mut *self.0.lock().unwrap(), data) |
