@dinoxx/dinox-cli 2.18.1 → 2.18.2
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/editor/install.d.ts
CHANGED
|
@@ -21,6 +21,15 @@ export type InstallOptions = {
|
|
|
21
21
|
};
|
|
22
22
|
/** The dsh CLI that ships with Desktop matches its runtime; fall back to PATH. */
|
|
23
23
|
export declare function findDshCli(options?: Pick<InstallOptions, 'dsh' | 'env'>): string | null;
|
|
24
|
+
/**
|
|
25
|
+
* On Windows the dsh CLI on PATH is an npm `dsh.cmd` shim, which `execFile`
|
|
26
|
+
* cannot start directly (EINVAL since Node 20.12.2); route it through cmd.exe.
|
|
27
|
+
*/
|
|
28
|
+
export declare function dshInvocation(file: string, args: string[], platform?: NodeJS.Platform): {
|
|
29
|
+
file: string;
|
|
30
|
+
args: string[];
|
|
31
|
+
options: import("child_process").SpawnOptions;
|
|
32
|
+
};
|
|
24
33
|
export declare function installDsh(options?: InstallOptions): Promise<{
|
|
25
34
|
host: "dsh";
|
|
26
35
|
profile: string;
|
package/dist/editor/install.js
CHANGED
|
@@ -4,6 +4,7 @@ import { rename, writeFile } from 'node:fs/promises';
|
|
|
4
4
|
import { homedir } from 'node:os';
|
|
5
5
|
import path from 'node:path';
|
|
6
6
|
import { promisify } from 'node:util';
|
|
7
|
+
import { agentLaunch } from '../gateway/spawnAgent.js';
|
|
7
8
|
import { DinoxError } from '../utils/errors.js';
|
|
8
9
|
import { getPackageVersion } from '../utils/version.js';
|
|
9
10
|
import { editorPackageRoot } from './paths.js';
|
|
@@ -77,8 +78,24 @@ function samePath(a, b) {
|
|
|
77
78
|
return path.resolve(a) === path.resolve(b);
|
|
78
79
|
}
|
|
79
80
|
}
|
|
81
|
+
/**
|
|
82
|
+
* On Windows the dsh CLI on PATH is an npm `dsh.cmd` shim, which `execFile`
|
|
83
|
+
* cannot start directly (EINVAL since Node 20.12.2); route it through cmd.exe.
|
|
84
|
+
*/
|
|
85
|
+
export function dshInvocation(file, args, platform = process.platform) {
|
|
86
|
+
const launch = agentLaunch(file, args, { windowsHide: true }, platform);
|
|
87
|
+
return { file: launch.command, args: [...launch.args], options: launch.options };
|
|
88
|
+
}
|
|
80
89
|
function defaultExec(file, args) {
|
|
81
|
-
|
|
90
|
+
let invocation;
|
|
91
|
+
try {
|
|
92
|
+
invocation = dshInvocation(file, args);
|
|
93
|
+
}
|
|
94
|
+
catch (error) {
|
|
95
|
+
return Promise.reject(new DinoxError(`dsh plugin failed: ${error.message}`, { code: 'COMMAND_FAILED' }));
|
|
96
|
+
}
|
|
97
|
+
const options = { ...invocation.options, timeout: 180_000, maxBuffer: 8 * 1024 * 1024 };
|
|
98
|
+
return run(invocation.file, invocation.args, options).then(() => undefined, (error) => {
|
|
82
99
|
const detail = String(error.stderr ?? '').trim().split('\n').slice(-5).join('\n');
|
|
83
100
|
throw new DinoxError(`dsh plugin failed: ${detail || error.message}`, { code: 'COMMAND_FAILED' });
|
|
84
101
|
});
|