diff options
| author | Julian Orth <ju.orth@gmail.com> | 2015-02-26 15:31:24 +0100 |
|---|---|---|
| committer | Julian Orth <ju.orth@gmail.com> | 2015-02-27 02:36:40 +0100 |
| commit | c9168cca72105297a5d66dee0beb0bb192cb01ad (patch) | |
| tree | 29498a15bff2f0bf2fb0acf9d8f10d3d4079a9cf /src | |
| parent | 41f8b1e89b5ca0c79d7bca782ca44085624d4564 (diff) | |
| download | rust-c9168cca72105297a5d66dee0beb0bb192cb01ad.tar.gz rust-c9168cca72105297a5d66dee0beb0bb192cb01ad.zip | |
libtest: flush output after every write
Useful for debugging tests that hang forever.
Diffstat (limited to 'src')
| -rw-r--r-- | src/libtest/lib.rs | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/src/libtest/lib.rs b/src/libtest/lib.rs index 82c1a4b1195..7c7f1fd478a 100644 --- a/src/libtest/lib.rs +++ b/src/libtest/lib.rs @@ -506,16 +506,25 @@ impl<T: Writer> ConsoleTestState<T> { if self.use_color { try!(term.reset()); } - Ok(()) + term.flush() + } + Raw(ref mut stdout) => { + try!(stdout.write_all(word.as_bytes())); + stdout.flush() } - Raw(ref mut stdout) => stdout.write_all(word.as_bytes()) } } pub fn write_plain(&mut self, s: &str) -> old_io::IoResult<()> { match self.out { - Pretty(ref mut term) => term.write_all(s.as_bytes()), - Raw(ref mut stdout) => stdout.write_all(s.as_bytes()) + Pretty(ref mut term) => { + try!(term.write_all(s.as_bytes())); + term.flush() + }, + Raw(ref mut stdout) => { + try!(stdout.write_all(s.as_bytes())); + stdout.flush() + }, } } |
