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
diff options
context:
space:
mode:
Diffstat (limited to 'lib/utils/log-file.js')
-rw-r--r--lib/utils/log-file.js5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/utils/log-file.js b/lib/utils/log-file.js
index 282c72700..9cf6513be 100644
--- a/lib/utils/log-file.js
+++ b/lib/utils/log-file.js
@@ -9,6 +9,7 @@ const fs = require('@npmcli/fs')
const log = require('./log-shim')
const padZero = (n, length) => n.toString().padStart(length.toString().length, '0')
+const globify = pattern => pattern.split('\\').join('/')
const _logHandler = Symbol('logHandler')
const _formatLogItem = Symbol('formatLogItem')
@@ -225,7 +226,7 @@ class LogFiles {
)
// Always ignore the currently written files
- const files = await glob(logGlob, { ignore: this.#files })
+ const files = await glob(globify(logGlob), { ignore: this.#files.map(globify) })
const toDelete = files.length - this.#logsMax
if (toDelete <= 0) {
@@ -236,7 +237,7 @@ class LogFiles {
for (const file of files.slice(0, toDelete)) {
try {
- await rimraf(file)
+ await rimraf(file, { glob: false })
} catch (e) {
log.silly('logfile', 'error removing log file', file, e)
}