about summary refs log tree commit diff
diff options
context:
space:
mode:
authorjyn <github@jyn.dev>2023-07-09 21:03:01 -0500
committerjyn <github@jyn.dev>2023-07-14 17:27:20 -0500
commita5de56a95eb9d49e945e68f736fa7599ef8b5482 (patch)
treef504f8bfd56bf4cc71e40cfdfab488732177232e
parentdf5cc59a68b8af5a45c657edef29a6f1d10a5a2e (diff)
downloadrust-a5de56a95eb9d49e945e68f736fa7599ef8b5482.tar.gz
rust-a5de56a95eb9d49e945e68f736fa7599ef8b5482.zip
Make sure toolstates.json ends in a newline
This avoids the following broken logging in CI:
```
{"book":"test-pass","reference":"test-pass","rustbook":"test-fail","rust-by-example":"test-pass","nomicon":"test-pass","embedded-book":"test-pass","edition-guide":"test-pass"}::group::Building bootstrap
```
-rw-r--r--src/bootstrap/toolstate.rs5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/bootstrap/toolstate.rs b/src/bootstrap/toolstate.rs
index 9c4d0ea265d..1285603a63d 100644
--- a/src/bootstrap/toolstate.rs
+++ b/src/bootstrap/toolstate.rs
@@ -262,6 +262,8 @@ impl Builder<'_> {
     /// `rust.save-toolstates` in `config.toml`. If unspecified, nothing will be
     /// done. The file is updated immediately after this function completes.
     pub fn save_toolstate(&self, tool: &str, state: ToolState) {
+        use std::io::Write;
+
         // If we're in a dry run setting we don't want to save toolstates as
         // that means if we e.g. panic down the line it'll look like we tested
         // everything (but we actually haven't).
@@ -286,7 +288,8 @@ impl Builder<'_> {
             current_toolstates.insert(tool.into(), state);
             t!(file.seek(SeekFrom::Start(0)));
             t!(file.set_len(0));
-            t!(serde_json::to_writer(file, &current_toolstates));
+            t!(serde_json::to_writer(&file, &current_toolstates));
+            t!(writeln!(file)); // make sure this ends in a newline
         }
     }
 }