tt-help-cli-ycl 1.4.88 → 1.4.89

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tt-help-cli-ycl",
3
- "version": "1.4.88",
3
+ "version": "1.4.89",
4
4
  "description": "TikTok user & video data scraper - extract ttSeller, verified, locationCreated from HTML source",
5
5
  "type": "module",
6
6
  "bin": {
@@ -711,7 +711,11 @@ export class WatchdogAgent {
711
711
  String(Math.max(5, Math.round(this.intervalMs / 1000))),
712
712
  );
713
713
 
714
- // 新进程日志重定向到文件,启动崩溃时有据可查
714
+ // 交互式终端(用户在 cmd 窗口里手动跑 tt-help watchdog):
715
+ // 升级重启后接管原控制台窗口继续显示(stdio inherit + 不 detached),窗口不消失
716
+ const interactive = !!process.stdout.isTTY;
717
+
718
+ // 非交互(计划任务/脚本/无人值守)时,新进程日志重定向到文件,崩溃有据可查
715
719
  let logFd = undefined;
716
720
  try {
717
721
  const logPath = join(
@@ -726,17 +730,18 @@ export class WatchdogAgent {
726
730
  let child;
727
731
  try {
728
732
  child = spawn(process.execPath, [cliPath, ...args], {
729
- detached: true,
730
- stdio: ["ignore", out, out],
731
- windowsHide: true, // Windows 隐藏控制台窗口
733
+ // 交互式:继承原 cmd 窗口一直显示;非交互:后台运行 + 日志文件
734
+ detached: !interactive,
735
+ stdio: interactive ? "inherit" : ["ignore", out, out],
736
+ windowsHide: !interactive, // 交互时不隐藏,保留可见窗口
732
737
  });
733
738
  } catch (e) {
734
739
  console.error(`[upgrade] 重启自身失败: ${e.message},保持旧进程运行`);
735
740
  this._recoverAfterFailedUpgrade();
736
741
  return;
737
742
  }
738
- // 新进程独立存活(父进程退出不影响)
739
- child.unref();
743
+ // 非交互后台进程独立存活(父进程退出不影响);交互式继承窗口无需 unref
744
+ if (!interactive) child.unref();
740
745
 
741
746
  // 存活确认:轮询新进程是否正常存活,确认后才退出旧进程
742
747
  let exited = false;