cliclaw 1.0.19 → 1.0.21
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/bin/cli.js +5 -4
- package/package.json +1 -1
package/bin/cli.js
CHANGED
|
@@ -284,11 +284,11 @@ function cmdUpdate() {
|
|
|
284
284
|
// directory during scanning). Try normally first; if EBUSY, fall back to
|
|
285
285
|
// pack + extract + copy-in-place (no directory rename needed).
|
|
286
286
|
try {
|
|
287
|
-
|
|
287
|
+
execSync('npm install -g cliclaw@latest', { stdio: 'pipe', encoding: 'utf8' })
|
|
288
288
|
updated = true
|
|
289
289
|
} catch (e) {
|
|
290
290
|
const msg = (e.stdout || '') + (e.stderr || '') + (e.message || '')
|
|
291
|
-
if (!msg.includes('EBUSY')) throw e
|
|
291
|
+
if (!msg.includes('EBUSY') && !String(e.status || '').includes('4082')) throw e
|
|
292
292
|
|
|
293
293
|
warn('EBUSY detected (Windows Defender lock) — using fallback install...')
|
|
294
294
|
const tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'cliclaw-upd-'))
|
|
@@ -301,11 +301,12 @@ function cmdUpdate() {
|
|
|
301
301
|
if (!tgzName) throw new Error('npm pack did not produce a .tgz file')
|
|
302
302
|
|
|
303
303
|
// 2. Extract using the built-in Windows tar (available since Win10 1803)
|
|
304
|
+
// Use relative paths + cwd so tar doesn't misinterpret "C:" as a network host.
|
|
304
305
|
const extractDir = path.join(tmpDir, 'x')
|
|
305
306
|
fs.mkdirSync(extractDir)
|
|
306
307
|
const winTar = path.join(process.env.SystemRoot || 'C:\\Windows', 'System32', 'tar.exe')
|
|
307
|
-
execSync(`"${winTar}" -xzf "${
|
|
308
|
-
{ stdio: 'pipe' })
|
|
308
|
+
execSync(`"${winTar}" -xzf "${tgzName}" -C "x"`,
|
|
309
|
+
{ stdio: 'pipe', cwd: tmpDir })
|
|
309
310
|
|
|
310
311
|
// 3. Copy files into the existing directory (no directory rename = no EBUSY)
|
|
311
312
|
const pkgDir = path.join(extractDir, 'package')
|