Don't require the output from libtest to be valid UTF-8
On Windows this is sometimes not the case, for reasons I can't track down. This works around the problem, although I'm not sure how to confirm we're not generating invalid build metrics in this case.
This commit is contained in:
parent
2f5e6bb817
commit
f9a81e4769
@ -88,10 +88,10 @@ impl<'a> Renderer<'a> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn render_all(mut self) {
|
fn render_all(mut self) {
|
||||||
let mut line = String::new();
|
let mut line = Vec::new();
|
||||||
loop {
|
loop {
|
||||||
line.clear();
|
line.clear();
|
||||||
match self.stdout.read_line(&mut line) {
|
match self.stdout.read_until(b'\n', &mut line) {
|
||||||
Ok(_) => {}
|
Ok(_) => {}
|
||||||
Err(err) if err.kind() == std::io::ErrorKind::UnexpectedEof => break,
|
Err(err) if err.kind() == std::io::ErrorKind::UnexpectedEof => break,
|
||||||
Err(err) => panic!("failed to read output of test runner: {err}"),
|
Err(err) => panic!("failed to read output of test runner: {err}"),
|
||||||
@ -100,12 +100,13 @@ impl<'a> Renderer<'a> {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
match serde_json::from_str(&line) {
|
match serde_json::from_slice(&line) {
|
||||||
Ok(parsed) => self.render_message(parsed),
|
Ok(parsed) => self.render_message(parsed),
|
||||||
Err(_err) => {
|
Err(_err) => {
|
||||||
// Handle non-JSON output, for example when --nocapture is passed.
|
// Handle non-JSON output, for example when --nocapture is passed.
|
||||||
print!("{line}");
|
let mut stdout = std::io::stdout();
|
||||||
let _ = std::io::stdout().flush();
|
stdout.write_all(&line).unwrap();
|
||||||
|
let _ = stdout.flush();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user