mirror of
https://github.com/denoland/deno.git
synced 2025-03-10 14:17:49 -04:00
fix: do not show cache initialization errors if stderr is piped (#18920)
Closes #18918
This commit is contained in:
parent
03398ddace
commit
f63b13fc96
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
|
// 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:?})",
|
"Could not initialize cache database '{}', deleting and retrying... ({err:?})",
|
||||||
path.to_string_lossy()
|
path.to_string_lossy()
|
||||||
);
|
);
|
||||||
|
@ -275,7 +277,12 @@ impl CacheDB {
|
||||||
|
|
||||||
match self.config.on_failure {
|
match self.config.on_failure {
|
||||||
CacheFailure::InMemory => {
|
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.",
|
"Failed to open cache file '{}', opening in-memory cache.",
|
||||||
path.to_string_lossy()
|
path.to_string_lossy()
|
||||||
);
|
);
|
||||||
|
@ -284,7 +291,12 @@ impl CacheDB {
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
CacheFailure::Blackhole => {
|
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.",
|
"Failed to open cache file '{}', performance may be degraded.",
|
||||||
path.to_string_lossy()
|
path.to_string_lossy()
|
||||||
);
|
);
|
||||||
|
|
Loading…
Add table
Reference in a new issue