tt-help-cli-ycl 1.4.160 → 1.4.161
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/package.json +2 -2
- package/src/watchdog/upgrader.js +14 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tt-help-cli-ycl",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.161",
|
|
4
4
|
"description": "TikTok user & video data scraper - extract ttSeller, verified, locationCreated from HTML source",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -48,4 +48,4 @@
|
|
|
48
48
|
"devDependencies": {
|
|
49
49
|
"better-sqlite3": "^12.10.0"
|
|
50
50
|
}
|
|
51
|
-
}
|
|
51
|
+
}
|
package/src/watchdog/upgrader.js
CHANGED
|
@@ -705,10 +705,22 @@ export async function runUpgradeMode(argv) {
|
|
|
705
705
|
`[upgrade-proc] 开始下载新版: npm install -g ${PACKAGE}@latest ...`,
|
|
706
706
|
);
|
|
707
707
|
const beforeVersion = getVersion(); // 下载前版本,用于验证 npm install 真正生效
|
|
708
|
-
|
|
708
|
+
let result = await performUpgrade();
|
|
709
|
+
if (!result.success && /EBUSY|resource busy/i.test(result.output)) {
|
|
710
|
+
// Windows 实测:运行中的 node/watchdog 或其 cwd 在包目录内时,npm 覆盖文件报 EBUSY。
|
|
711
|
+
// 此刻升级已势在必行(版本差已确认),终止旧 watchdog 释放文件锁后重试安装。
|
|
712
|
+
console.error(
|
|
713
|
+
`[upgrade-proc] 包目录被运行进程锁定(EBUSY),终止旧 watchdog 释放锁后重试安装...`,
|
|
714
|
+
);
|
|
715
|
+
const lockSnapshot = await snapshotAllProcesses();
|
|
716
|
+
const lockDescPids = listDescendantPids(lockSnapshot, oldPid, process.pid);
|
|
717
|
+
await terminateProcess(oldPid, 5000);
|
|
718
|
+
await killPidList(lockDescPids, "[upgrade-proc] 已停止旧 watchdog 释放包目录锁");
|
|
719
|
+
result = await performUpgrade();
|
|
720
|
+
}
|
|
709
721
|
if (!result.success) {
|
|
710
722
|
const err = result.output.substring(0, 300);
|
|
711
|
-
console.error(`[upgrade-proc]
|
|
723
|
+
console.error(`[upgrade-proc] 下载失败,保持当前状态: ${err}`);
|
|
712
724
|
process.exit(1);
|
|
713
725
|
}
|
|
714
726
|
|