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-04-21 06:10:37 +0300
committerRuy Adorno <ruyadorno@hotmail.com>2022-04-26 23:27:44 +0300
commit9ea26038ad4d3dc971d442cba2bb02a35755c07a (patch)
tree6018d586b4c2c989c4be8d816af3f60e0576a084 /lib/utils
parent0f2da5dca54862707a00d2254bf4c0b4c2e0be60 (diff)
fix: normalize win32 paths before globbing
Diffstat (limited to 'lib/utils')
-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)
}