mirror of
https://github.com/denoland/deno.git
synced 2024-12-23 15:49:44 -05:00
fix: do not show cache initialization errors if stderr is piped (#18920)
Closes #18918
This commit is contained in:
parent
3b69d238cd
commit
42a3f52e98
1 changed files with 15 additions and 3 deletions
18
cli/cache/cache_db.rs
vendored
18
cli/cache/cache_db.rs
vendored
|
@ -261,7 +261,9 @@ impl CacheDB {
|
|||
};
|
||||
|
||||
// Failed, try deleting it
|
||||
log::warn!(
|
||||
let is_tty = atty::is(atty::Stream::Stderr);
|
||||
log::log!(
|
||||
if is_tty { log::Level::Warn } else { log::Level::Trace },
|
||||
"Could not initialize cache database '{}', deleting and retrying... ({err:?})",
|
||||
path.to_string_lossy()
|
||||
);
|
||||
|
@ -275,7 +277,12 @@ impl CacheDB {
|
|||
|
||||
match self.config.on_failure {
|
||||
CacheFailure::InMemory => {
|
||||
log::error!(
|
||||
log::log!(
|
||||
if is_tty {
|
||||
log::Level::Error
|
||||
} else {
|
||||
log::Level::Trace
|
||||
},
|
||||
"Failed to open cache file '{}', opening in-memory cache.",
|
||||
path.to_string_lossy()
|
||||
);
|
||||
|
@ -284,7 +291,12 @@ impl CacheDB {
|
|||
))
|
||||
}
|
||||
CacheFailure::Blackhole => {
|
||||
log::error!(
|
||||
log::log!(
|
||||
if is_tty {
|
||||
log::Level::Error
|
||||
} else {
|
||||
log::Level::Trace
|
||||
},
|
||||
"Failed to open cache file '{}', performance may be degraded.",
|
||||
path.to_string_lossy()
|
||||
);
|
||||
|
|
Loading…
Reference in a new issue