Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/npm/cli.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib/utils
diff options
context:
space:
mode:
authorLuke Karrys <luke@lukekarrys.com>2022-07-21 19:40:55 +0300
committerGitHub <noreply@github.com>2022-07-21 19:40:55 +0300
commit9905d0e24c162c3f6cc006fa86b4c9d0205a4c6f (patch)
treea3cfb0299f07f902465ecf3850496ebeea01900a /lib/utils
parent4c945302fc2aa6854dc014fe31d6f5dfa96f7b52 (diff)
fix: don't fail immediately if cache dir is not accessible (#5197)
This also changes all the log messages about not being able to create initial directories and files to `log.verbose` since we know run those commands on init. There are a lot of valid reasons why those might fail, and we don't want to show a warning for them every time. Fixes: #4769 Fixes: #4838 Fixes: #4996
Diffstat (limited to 'lib/utils')
-rw-r--r--lib/utils/log-file.js6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/utils/log-file.js b/lib/utils/log-file.js
index 9cf6513be..d62329c85 100644
--- a/lib/utils/log-file.js
+++ b/lib/utils/log-file.js
@@ -204,7 +204,9 @@ class LogFiles {
this.#files.push(logStream.path)
return logStream
} catch (e) {
- log.warn('logfile', `could not be created: ${e}`)
+ // If the user has a readonly logdir then we don't want to
+ // warn this on every command so it should be verbose
+ log.verbose('logfile', `could not be created: ${e}`)
}
}
@@ -226,7 +228,7 @@ class LogFiles {
)
// Always ignore the currently written files
- const files = await glob(globify(logGlob), { ignore: this.#files.map(globify) })
+ const files = await glob(globify(logGlob), { ignore: this.#files.map(globify), silent: true })
const toDelete = files.length - this.#logsMax
if (toDelete <= 0) {