tt-help-cli-ycl 1.4.120 → 1.4.121
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 +1 -1
- package/src/watchdog/agent.js +12 -3
package/package.json
CHANGED
package/src/watchdog/agent.js
CHANGED
|
@@ -30,6 +30,7 @@ import { fileURLToPath } from "url";
|
|
|
30
30
|
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
31
31
|
const homeDir = homedir() || process.env.HOME || process.env.USERPROFILE || "";
|
|
32
32
|
const TT_HELP_CONFIG = join(homeDir, ".tt-help.json");
|
|
33
|
+
const IS_WIN = process.platform === "win32";
|
|
33
34
|
|
|
34
35
|
// ── 业务日志错误统计 → 触发节点切换 ──
|
|
35
36
|
// 识别采集程序日志里已有的错误分类标签(explore 等已打标),连续错误达标则切换出口节点
|
|
@@ -612,9 +613,17 @@ export class WatchdogAgent {
|
|
|
612
613
|
if (cfg.proxy) args.push("--proxy", cfg.proxy);
|
|
613
614
|
|
|
614
615
|
const { stdout, stderr, code } = await new Promise((resolve) => {
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
616
|
+
// Windows 下 tt-help 是 .cmd 包装,必须 shell:true 才能被 cmd.exe 解析
|
|
617
|
+
// (与 process-manager.startCommand 的 Windows 处理保持一致)
|
|
618
|
+
const child = IS_WIN
|
|
619
|
+
? spawn([cmd, ...args].join(" "), {
|
|
620
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
621
|
+
shell: true,
|
|
622
|
+
windowsHide: true,
|
|
623
|
+
})
|
|
624
|
+
: spawn(cmd, args, {
|
|
625
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
626
|
+
});
|
|
618
627
|
let out = "",
|
|
619
628
|
err = "";
|
|
620
629
|
child.stdout.on("data", (d) => (out += d));
|