aurix-ai 2.7.7 → 2.7.8
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/bin/aurix.js +45 -13
- package/package.json +1 -1
package/bin/aurix.js
CHANGED
|
@@ -19,23 +19,55 @@ try {
|
|
|
19
19
|
runtime = 'bun';
|
|
20
20
|
} catch {}
|
|
21
21
|
|
|
22
|
+
// Use shell: false with an absolute path to the Node binary. shell: true
|
|
23
|
+
// triggers DEP0190 (args concatenated without escaping). process.execPath
|
|
24
|
+
// points at the real node.exe even when launched through a .cmd shim on
|
|
25
|
+
// Windows, so spawn() works without shell: true.
|
|
26
|
+
let runtimeBin = process.execPath;
|
|
27
|
+
if (runtime === 'bun') {
|
|
28
|
+
try {
|
|
29
|
+
runtimeBin = execSync('bun -e "process.stdout.write(process.execPath)"', { encoding: 'utf8' }).trim() || 'bun';
|
|
30
|
+
} catch {
|
|
31
|
+
runtimeBin = 'bun';
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
22
35
|
const nodeArgs = [];
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
//
|
|
27
|
-
//
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
36
|
+
let selfRelaunch = false;
|
|
37
|
+
|
|
38
|
+
if (runtime === 'node' && !process.env.AURIX_RELAUNCHED) {
|
|
39
|
+
// OpenTUI's backend does `require("node:ffi")` which is experimental in
|
|
40
|
+
// Node 22.5+. Probe whether it already works without a flag, and only
|
|
41
|
+
// inject --experimental-ffi if it actually fails AND the flag is valid
|
|
42
|
+
// on this Node build. If neither works, launch without the flag and let
|
|
43
|
+
// the in-process fallback render a diagnostic message.
|
|
44
|
+
let needsFlag = false;
|
|
45
|
+
try {
|
|
46
|
+
execSync(`"${runtimeBin}" -e "require(\\"node:ffi\\")"`, { stdio: 'ignore' });
|
|
47
|
+
} catch {
|
|
48
|
+
needsFlag = true;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
if (needsFlag) {
|
|
52
|
+
let flagWorks = false;
|
|
53
|
+
try {
|
|
54
|
+
execSync(`"${runtimeBin}" --experimental-ffi -e "0"`, { stdio: 'ignore' });
|
|
55
|
+
flagWorks = true;
|
|
56
|
+
} catch {}
|
|
57
|
+
|
|
58
|
+
if (flagWorks) {
|
|
59
|
+
nodeArgs.push('--experimental-ffi');
|
|
60
|
+
selfRelaunch = true;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
33
63
|
}
|
|
34
64
|
|
|
35
|
-
const
|
|
65
|
+
const env = { ...process.env, AURIX_HOME: join(__dirname, '..') };
|
|
66
|
+
if (selfRelaunch) env.AURIX_RELAUNCHED = '1';
|
|
67
|
+
|
|
68
|
+
const child = spawn(runtimeBin, [...nodeArgs, dist, ...process.argv.slice(2)], {
|
|
36
69
|
stdio: 'inherit',
|
|
37
|
-
env
|
|
38
|
-
shell: process.platform === 'win32',
|
|
70
|
+
env,
|
|
39
71
|
});
|
|
40
72
|
|
|
41
73
|
child.on('close', (code) => process.exit(code ?? 0));
|