@wu529778790/open-im 1.10.3-beta.2 → 1.10.3
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/dist/node-exec.d.ts +6 -2
- package/dist/node-exec.js +9 -2
- package/package.json +1 -1
package/dist/node-exec.d.ts
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* 用于 spawn 子进程的 Node 可执行文件路径。
|
|
3
|
-
*
|
|
4
|
-
*
|
|
3
|
+
*
|
|
4
|
+
* Windows:`fs.existsSync(process.execPath)` 为真时,`spawn(process.execPath)` 仍可能 ENOENT
|
|
5
|
+
*(权限/重解析/全局 npm 与当前 shell 的 node 不一致等)。未设置 OPEN_IM_NODE 时优先用 PATH 上的 `node`,
|
|
6
|
+
* 与交互式 `where node`、`node -v` 行为一致。
|
|
7
|
+
*
|
|
8
|
+
* 非 Windows:仍优先使用 `process.execPath`(与当前进程同源)。
|
|
5
9
|
*/
|
|
6
10
|
export declare function resolveNodeExecutable(): string;
|
package/dist/node-exec.js
CHANGED
|
@@ -1,14 +1,21 @@
|
|
|
1
1
|
import { existsSync } from "node:fs";
|
|
2
2
|
/**
|
|
3
3
|
* 用于 spawn 子进程的 Node 可执行文件路径。
|
|
4
|
-
*
|
|
5
|
-
*
|
|
4
|
+
*
|
|
5
|
+
* Windows:`fs.existsSync(process.execPath)` 为真时,`spawn(process.execPath)` 仍可能 ENOENT
|
|
6
|
+
*(权限/重解析/全局 npm 与当前 shell 的 node 不一致等)。未设置 OPEN_IM_NODE 时优先用 PATH 上的 `node`,
|
|
7
|
+
* 与交互式 `where node`、`node -v` 行为一致。
|
|
8
|
+
*
|
|
9
|
+
* 非 Windows:仍优先使用 `process.execPath`(与当前进程同源)。
|
|
6
10
|
*/
|
|
7
11
|
export function resolveNodeExecutable() {
|
|
8
12
|
const fromEnv = (process.env.OPEN_IM_NODE ?? process.env.NODE_EXE)?.trim();
|
|
9
13
|
if (fromEnv && existsSync(fromEnv)) {
|
|
10
14
|
return fromEnv;
|
|
11
15
|
}
|
|
16
|
+
if (process.platform === "win32") {
|
|
17
|
+
return "node";
|
|
18
|
+
}
|
|
12
19
|
if (process.execPath && existsSync(process.execPath)) {
|
|
13
20
|
return process.execPath;
|
|
14
21
|
}
|