diff options
author | David Sherret <dsherret@users.noreply.github.com> | 2022-10-26 17:20:41 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-26 21:20:41 +0000 |
commit | 65f12f571bf7b791a0bc8ceb604af3802c487bf9 (patch) | |
tree | a9557fedbf9b9efbfa51f9e85824166f13db10f1 | |
parent | 37340e23865b17b1466a7e32997b0add96dd3806 (diff) |
fix(cli): do not log update checker when log level is quiet (#16433)
Co-authored-by: lucacasonato <hello@lcas.dev>
-rw-r--r-- | cli/tools/upgrade.rs | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/cli/tools/upgrade.rs b/cli/tools/upgrade.rs index eaead9ff6..787dc05db 100644 --- a/cli/tools/upgrade.rs +++ b/cli/tools/upgrade.rs @@ -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.") |