pinokiod 8.0.9 → 8.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/kernel/path_removal.js +17 -0
- package/package.json +1 -1
package/kernel/path_removal.js
CHANGED
|
@@ -89,24 +89,41 @@ const createPathRemover = (dependencies = {}) => {
|
|
|
89
89
|
operation = "Removing files",
|
|
90
90
|
...rmOptions
|
|
91
91
|
} = options
|
|
92
|
+
const trace = (stage, details = "") => {
|
|
93
|
+
if (platform === "win32") {
|
|
94
|
+
console.log(`[path removal] ${stage} target=${resolvedTarget}${details ? ` ${details}` : ""}`)
|
|
95
|
+
}
|
|
96
|
+
}
|
|
92
97
|
|
|
98
|
+
const removeStartedAt = Date.now()
|
|
99
|
+
trace("rm:start")
|
|
93
100
|
try {
|
|
94
101
|
await fsPromises.rm(resolvedTarget, rmOptions)
|
|
102
|
+
trace("rm:done", `elapsedMs=${Date.now() - removeStartedAt}`)
|
|
95
103
|
return { removed: true, target: resolvedTarget }
|
|
96
104
|
} catch (error) {
|
|
97
105
|
if (platform !== "win32") {
|
|
98
106
|
throw error
|
|
99
107
|
}
|
|
108
|
+
trace("rm:failed", `elapsedMs=${Date.now() - removeStartedAt} code=${error && error.code ? error.code : "unknown"}`)
|
|
100
109
|
|
|
110
|
+
const scanStartedAt = Date.now()
|
|
111
|
+
trace("scan:start")
|
|
101
112
|
const remaining = await collectRemaining(resolvedTarget, fsPromises)
|
|
113
|
+
trace("scan:done", `elapsedMs=${Date.now() - scanStartedAt} paths=${remaining.paths.length} files=${remaining.files.length}`)
|
|
102
114
|
if (remaining.paths.length === 0) {
|
|
103
115
|
throw error
|
|
104
116
|
}
|
|
105
117
|
|
|
106
118
|
let inspection = { blockers: [] }
|
|
119
|
+
const inspectionStartedAt = Date.now()
|
|
120
|
+
trace("restart-manager:start", `files=${remaining.files.length}`)
|
|
107
121
|
try {
|
|
108
122
|
inspection = await inspectLocks(remaining.files)
|
|
123
|
+
const blockerCount = Array.isArray(inspection && inspection.blockers) ? inspection.blockers.length : 0
|
|
124
|
+
trace("restart-manager:done", `elapsedMs=${Date.now() - inspectionStartedAt} blockers=${blockerCount}`)
|
|
109
125
|
} catch (inspectionError) {
|
|
126
|
+
trace("restart-manager:failed", `elapsedMs=${Date.now() - inspectionStartedAt} message=${inspectionError && inspectionError.message ? inspectionError.message : String(inspectionError)}`)
|
|
110
127
|
console.warn("[path removal] Restart Manager inspection failed", inspectionError)
|
|
111
128
|
}
|
|
112
129
|
|