tt-help-cli-ycl 1.4.83 → 1.4.85
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
package/src/watchdog/agent.js
CHANGED
|
@@ -437,6 +437,7 @@ export class WatchdogAgent {
|
|
|
437
437
|
const child = spawn(process.execPath, [daemonPath, "--country", "US"], {
|
|
438
438
|
stdio: ["ignore", "pipe", "pipe"],
|
|
439
439
|
detached: false,
|
|
440
|
+
windowsHide: true, // Windows 隐藏控制台窗口
|
|
440
441
|
});
|
|
441
442
|
|
|
442
443
|
child.stdout?.on("data", (d) => {
|
|
@@ -507,6 +508,7 @@ export class WatchdogAgent {
|
|
|
507
508
|
child = spawn(process.execPath, [cliPath, ...args], {
|
|
508
509
|
detached: true,
|
|
509
510
|
stdio: "ignore",
|
|
511
|
+
windowsHide: true, // Windows 隐藏控制台窗口
|
|
510
512
|
});
|
|
511
513
|
child.unref();
|
|
512
514
|
} catch (e) {
|
|
@@ -81,6 +81,7 @@ function getProcessStats(pid) {
|
|
|
81
81
|
encoding: "utf-8",
|
|
82
82
|
timeout: 5000,
|
|
83
83
|
stdio: ["ignore", "pipe", "ignore"],
|
|
84
|
+
windowsHide: true, // Windows 隐藏控制台窗口
|
|
84
85
|
},
|
|
85
86
|
).trim();
|
|
86
87
|
try {
|
|
@@ -104,6 +105,7 @@ function getProcessStats(pid) {
|
|
|
104
105
|
encoding: "utf-8",
|
|
105
106
|
timeout: 3000,
|
|
106
107
|
stdio: ["ignore", "pipe", "ignore"],
|
|
108
|
+
windowsHide: true,
|
|
107
109
|
}).trim();
|
|
108
110
|
if (!stdout) return null;
|
|
109
111
|
const parts = stdout.split(/\s+/);
|
|
@@ -123,7 +125,12 @@ function getChildPid(parentPid) {
|
|
|
123
125
|
try {
|
|
124
126
|
const out = execSync(
|
|
125
127
|
`powershell -NoProfile -Command "Get-CimInstance Win32_Process -Filter 'ParentProcessId=${parentPid}' | Where-Object { $_.Name -notlike 'conhost*' } | Select-Object -First 1 -ExpandProperty ProcessId"`,
|
|
126
|
-
{
|
|
128
|
+
{
|
|
129
|
+
encoding: "utf-8",
|
|
130
|
+
timeout: 3000,
|
|
131
|
+
stdio: ["ignore", "pipe", "ignore"],
|
|
132
|
+
windowsHide: true, // Windows 隐藏控制台窗口
|
|
133
|
+
},
|
|
127
134
|
).trim();
|
|
128
135
|
return parseInt(out, 10) || 0;
|
|
129
136
|
} catch {
|
|
@@ -170,10 +177,12 @@ export class ProcessManager extends EventEmitter {
|
|
|
170
177
|
stdio: ["ignore", "pipe", "pipe"],
|
|
171
178
|
detached: false,
|
|
172
179
|
shell: true,
|
|
180
|
+
windowsHide: true, // Windows 隐藏 cmd 控制台窗口
|
|
173
181
|
})
|
|
174
182
|
: spawn(command, args, {
|
|
175
183
|
stdio: ["ignore", "pipe", "pipe"],
|
|
176
184
|
detached: false,
|
|
185
|
+
windowsHide: true,
|
|
177
186
|
});
|
|
178
187
|
|
|
179
188
|
// Windows: shell:true → child.pid 是 cmd.exe,延迟获取真实 node.exe PID(用于内存读取)
|
|
@@ -294,6 +303,7 @@ export class ProcessManager extends EventEmitter {
|
|
|
294
303
|
execSync(`taskkill /PID ${info.child.pid} /T /F`, {
|
|
295
304
|
stdio: ["ignore", "ignore", "ignore"],
|
|
296
305
|
timeout: 5000,
|
|
306
|
+
windowsHide: true, // Windows 隐藏控制台窗口
|
|
297
307
|
});
|
|
298
308
|
} else {
|
|
299
309
|
// macOS/Linux: 优雅终止,2 秒后强制 kill
|
package/src/watchdog/upgrader.js
CHANGED
|
@@ -64,7 +64,7 @@ export function performUpgrade() {
|
|
|
64
64
|
return new Promise((resolve) => {
|
|
65
65
|
exec(
|
|
66
66
|
`npm install -g ${PACKAGE}@latest`,
|
|
67
|
-
{ timeout: 120_000 },
|
|
67
|
+
{ timeout: 120_000, windowsHide: true }, // Windows 隐藏 cmd 窗口
|
|
68
68
|
(err, stdout, stderr) => {
|
|
69
69
|
if (err) {
|
|
70
70
|
resolve({ success: false, output: stderr || err.message });
|