Rollup merge of #112277 - jyn514:non-utf8-tests, r=ozkanonur
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 (maybe related to localization? the bug report had a french locale). This works around the problem, although I'm not sure how to confirm we're not generating invalid build metrics in this case. Fixes https://github.com/rust-lang/rust/issues/112273.
This commit is contained in:
commit
0716ac9bff
@ -88,10 +88,10 @@ fn new(stdout: ChildStdout, builder: &'a Builder<'a>) -> Self {
|
||||
}
|
||||
|
||||
fn render_all(mut self) {
|
||||
let mut line = String::new();
|
||||
let mut line = Vec::new();
|
||||
loop {
|
||||
line.clear();
|
||||
match self.stdout.read_line(&mut line) {
|
||||
match self.stdout.read_until(b'\n', &mut line) {
|
||||
Ok(_) => {}
|
||||
Err(err) if err.kind() == std::io::ErrorKind::UnexpectedEof => break,
|
||||
Err(err) => panic!("failed to read output of test runner: {err}"),
|
||||
@ -100,12 +100,13 @@ fn render_all(mut self) {
|
||||
break;
|
||||
}
|
||||
|
||||
match serde_json::from_str(&line) {
|
||||
match serde_json::from_slice(&line) {
|
||||
Ok(parsed) => self.render_message(parsed),
|
||||
Err(_err) => {
|
||||
// Handle non-JSON output, for example when --nocapture is passed.
|
||||
print!("{line}");
|
||||
let _ = std::io::stdout().flush();
|
||||
let mut stdout = std::io::stdout();
|
||||
stdout.write_all(&line).unwrap();
|
||||
let _ = stdout.flush();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user