@aipanel/core 1.2.18 → 1.2.19
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/es/node/node-utils.d.ts +2 -1
- package/es/node/node-utils.mjs +18 -4
- package/lib/node/node-utils.cjs +18 -4
- package/lib/node/node-utils.d.ts +2 -1
- package/package.json +1 -1
package/es/node/node-utils.d.ts
CHANGED
|
@@ -48,7 +48,8 @@ export declare function findGitRoot(startDir: string, maxDepth?: number): string
|
|
|
48
48
|
*/
|
|
49
49
|
export declare function checkCliInstalled(bin: string): Promise<boolean>;
|
|
50
50
|
/**
|
|
51
|
-
* 获取某 CLI 版本号(<bin> --version
|
|
51
|
+
* 获取某 CLI 版本号(<bin> --version,退出码 0 时取 stdout 首段,stdout 为空回退 stderr;败路返回 null)
|
|
52
|
+
* stderr 回退:部分 CLI(如个别平台的 dsh)把版本打在 stderr,仅读 stdout 会误判为“未解析出版本”。
|
|
52
53
|
*/
|
|
53
54
|
export declare function getCliVersion(bin: string): Promise<string | null>;
|
|
54
55
|
/** 孤儿进程清理配置(提供商的 check/kill 统一实现) */
|
package/es/node/node-utils.mjs
CHANGED
|
@@ -141,12 +141,20 @@ async function checkCliInstalled(bin) {
|
|
|
141
141
|
function getCliVersion(bin) {
|
|
142
142
|
return new Promise((resolve) => {
|
|
143
143
|
const proc = spawn(bin, ["--version"], { stdio: "pipe", shell: true });
|
|
144
|
-
let
|
|
144
|
+
let stdout = "";
|
|
145
|
+
let stderr = "";
|
|
145
146
|
proc.stdout?.on("data", (data) => {
|
|
146
|
-
|
|
147
|
+
stdout += data.toString();
|
|
148
|
+
});
|
|
149
|
+
proc.stderr?.on("data", (data) => {
|
|
150
|
+
stderr += data.toString();
|
|
147
151
|
});
|
|
148
152
|
proc.on("close", (code) => {
|
|
149
|
-
|
|
153
|
+
if (code !== 0) {
|
|
154
|
+
resolve(null);
|
|
155
|
+
return;
|
|
156
|
+
}
|
|
157
|
+
resolve(stdout.trim() || stderr.trim() || null);
|
|
150
158
|
});
|
|
151
159
|
proc.on("error", () => resolve(null));
|
|
152
160
|
});
|
|
@@ -184,7 +192,13 @@ function killOrphansOnWindows(resolve, options, label, timer) {
|
|
|
184
192
|
log.debug(`Using Windows method to find orphan ${label} processes`);
|
|
185
193
|
const proc = spawn(
|
|
186
194
|
"wmic",
|
|
187
|
-
[
|
|
195
|
+
[
|
|
196
|
+
"process",
|
|
197
|
+
"where",
|
|
198
|
+
`name="${options.winName}"`,
|
|
199
|
+
"get",
|
|
200
|
+
"processid,parentprocessid,commandline"
|
|
201
|
+
],
|
|
188
202
|
{ stdio: "pipe" }
|
|
189
203
|
);
|
|
190
204
|
let output = "";
|
package/lib/node/node-utils.cjs
CHANGED
|
@@ -178,12 +178,20 @@ async function checkCliInstalled(bin) {
|
|
|
178
178
|
function getCliVersion(bin) {
|
|
179
179
|
return new Promise((resolve) => {
|
|
180
180
|
const proc = (0, import_node_child_process.spawn)(bin, ["--version"], { stdio: "pipe", shell: true });
|
|
181
|
-
let
|
|
181
|
+
let stdout = "";
|
|
182
|
+
let stderr = "";
|
|
182
183
|
proc.stdout?.on("data", (data) => {
|
|
183
|
-
|
|
184
|
+
stdout += data.toString();
|
|
185
|
+
});
|
|
186
|
+
proc.stderr?.on("data", (data) => {
|
|
187
|
+
stderr += data.toString();
|
|
184
188
|
});
|
|
185
189
|
proc.on("close", (code) => {
|
|
186
|
-
|
|
190
|
+
if (code !== 0) {
|
|
191
|
+
resolve(null);
|
|
192
|
+
return;
|
|
193
|
+
}
|
|
194
|
+
resolve(stdout.trim() || stderr.trim() || null);
|
|
187
195
|
});
|
|
188
196
|
proc.on("error", () => resolve(null));
|
|
189
197
|
});
|
|
@@ -221,7 +229,13 @@ function killOrphansOnWindows(resolve, options, label, timer) {
|
|
|
221
229
|
log.debug(`Using Windows method to find orphan ${label} processes`);
|
|
222
230
|
const proc = (0, import_node_child_process.spawn)(
|
|
223
231
|
"wmic",
|
|
224
|
-
[
|
|
232
|
+
[
|
|
233
|
+
"process",
|
|
234
|
+
"where",
|
|
235
|
+
`name="${options.winName}"`,
|
|
236
|
+
"get",
|
|
237
|
+
"processid,parentprocessid,commandline"
|
|
238
|
+
],
|
|
225
239
|
{ stdio: "pipe" }
|
|
226
240
|
);
|
|
227
241
|
let output = "";
|
package/lib/node/node-utils.d.ts
CHANGED
|
@@ -48,7 +48,8 @@ export declare function findGitRoot(startDir: string, maxDepth?: number): string
|
|
|
48
48
|
*/
|
|
49
49
|
export declare function checkCliInstalled(bin: string): Promise<boolean>;
|
|
50
50
|
/**
|
|
51
|
-
* 获取某 CLI 版本号(<bin> --version
|
|
51
|
+
* 获取某 CLI 版本号(<bin> --version,退出码 0 时取 stdout 首段,stdout 为空回退 stderr;败路返回 null)
|
|
52
|
+
* stderr 回退:部分 CLI(如个别平台的 dsh)把版本打在 stderr,仅读 stdout 会误判为“未解析出版本”。
|
|
52
53
|
*/
|
|
53
54
|
export declare function getCliVersion(bin: string): Promise<string | null>;
|
|
54
55
|
/** 孤儿进程清理配置(提供商的 check/kill 统一实现) */
|