Skip to content

Commit

Permalink
fix(cli): do not log update checker when log level is quiet (denoland…
Browse files Browse the repository at this point in the history
…#16433)

Co-authored-by: lucacasonato <[email protected]>
  • Loading branch information
dsherret and lucacasonato authored Oct 26, 2022
1 parent 37340e2 commit 65f12f5
Showing 1 changed file with 15 additions and 8 deletions.
23 changes: 15 additions & 8 deletions cli/tools/upgrade.rs
Original file line number Diff line number Diff line change
Expand Up @@ -164,15 +164,22 @@ pub fn check_for_upgrades(cache_dir: PathBuf) {
});
}

// Print a message if an update is available, unless:
// * stderr is not a tty
// * we're already running the 'deno upgrade' command.
// Print a message if an update is available
if let Some(upgrade_version) = update_checker.should_prompt() {
if atty::is(atty::Stream::Stderr) {
eprint!(
"{} ",
colors::green(format!("Deno {upgrade_version} has been released."))
);
if log::log_enabled!(log::Level::Info) && atty::is(atty::Stream::Stderr) {
if version::is_canary() {
eprint!(
"{} ",
colors::green("A new canary release of Deno is available.")
);
} else {
eprint!(
"{} {} → {} ",
colors::green("A new release of Deno is available:"),
colors::cyan(version::deno()),
colors::cyan(upgrade_version)
);
}
eprintln!(
"{}",
colors::italic_gray("Run `deno upgrade` to install it.")
Expand Down

0 comments on commit 65f12f5

Please sign in to comment.