Skip to content

Commit 9a6afd0

Browse files
committed
write .last-warned-change-id only if environment is tty
As the .last-warned-change-id is only used for change tracking, we don't need to generate/write it outside of the tty. Otherwise, rust-analyzer could create this file, and developers wouldn't be able to see the bootstrap change alerts, assuming that they have already seen them. Signed-off-by: onur-ozkan <[email protected]>
1 parent 06f6cd9 commit 9a6afd0

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

Diff for: src/bootstrap/src/bin/main.rs

+7-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,10 @@
99
use std::io::Write;
1010
#[cfg(all(any(unix, windows), not(target_os = "solaris")))]
1111
use std::process;
12-
use std::{env, fs};
12+
use std::{
13+
env, fs,
14+
io::{self, IsTerminal},
15+
};
1316

1417
#[cfg(all(any(unix, windows), not(target_os = "solaris")))]
1518
use bootstrap::t;
@@ -140,7 +143,9 @@ fn check_version(config: &Config) -> Option<String> {
140143
"update `config.toml` to use `change-id = {latest_change_id}` instead"
141144
));
142145

143-
t!(fs::write(warned_id_path, id.to_string()));
146+
if io::stdout().is_terminal() {
147+
t!(fs::write(warned_id_path, id.to_string()));
148+
}
144149
}
145150
} else {
146151
msg.push_str("WARNING: The `change-id` is missing in the `config.toml`. This means that you will not be able to track the major changes made to the bootstrap configurations.\n");

0 commit comments

Comments
 (0)