1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-25 15:29:32 -05:00

fix(cli): do not log update checker when log level is quiet (#16433)

Co-authored-by: lucacasonato <hello@lcas.dev>
This commit is contained in:
David Sherret 2022-10-26 17:20:41 -04:00 committed by GitHub
parent 37340e2386
commit 65f12f571b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -164,15 +164,22 @@ pub fn check_for_upgrades(cache_dir: PathBuf) {
}); });
} }
// Print a message if an update is available, unless: // Print a message if an update is available
// * stderr is not a tty
// * we're already running the 'deno upgrade' command.
if let Some(upgrade_version) = update_checker.should_prompt() { if let Some(upgrade_version) = update_checker.should_prompt() {
if atty::is(atty::Stream::Stderr) { if log::log_enabled!(log::Level::Info) && atty::is(atty::Stream::Stderr) {
if version::is_canary() {
eprint!( eprint!(
"{} ", "{} ",
colors::green(format!("Deno {upgrade_version} has been released.")) 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!( eprintln!(
"{}", "{}",
colors::italic_gray("Run `deno upgrade` to install it.") colors::italic_gray("Run `deno upgrade` to install it.")