Skip to content

Commit

Permalink
Auto merge of #118789 - jyn514:dry-run, r=onur-ozkan
Browse files Browse the repository at this point in the history
fix --dry-run when the change-id warning is printed

previously:
```
Building bootstrap
   Compiling bootstrap v0.0.0 (/home/jyn/src/rust2/src/bootstrap)
    Finished dev [unoptimized] target(s) in 4.23s
thread 'main' panicked at src/bin/main.rs:147:17:
fs::write(warned_id_path, latest_change_id.to_string()) failed with No such file or directory (os error 2)
```
  • Loading branch information
bors committed Dec 14, 2023
2 parents 1aa6aef + 520662e commit 529047c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/bootstrap/src/bin/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ fn check_version(config: &Config) -> Option<String> {
"update `config.toml` to use `change-id = {latest_change_id}` instead"
));

if io::stdout().is_terminal() {
if io::stdout().is_terminal() && !config.dry_run() {
t!(fs::write(warned_id_path, latest_change_id.to_string()));
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/bootstrap/src/core/config/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1969,7 +1969,7 @@ impl Config {
config
}

pub(crate) fn dry_run(&self) -> bool {
pub fn dry_run(&self) -> bool {
match self.dry_run {
DryRun::Disabled => false,
DryRun::SelfCheck | DryRun::UserSelected => true,
Expand Down

0 comments on commit 529047c

Please sign in to comment.