@moxt-ai/mobius 0.0.336 → 0.0.337
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/cli.js +427 -353
- package/dist/cli.js.map +4 -4
- package/dist/runtime.js +350 -310
- package/dist/runtime.js.map +4 -4
- package/dist/util/filesystem/private-path.js +6 -324
- package/dist/util/filesystem/private-path.js.map +4 -4
- package/dist/util/platform/contracts.d.ts +0 -26
- package/dist/util/platform/contracts.d.ts.map +1 -1
- package/dist/util/platform/index.d.ts.map +1 -1
- package/dist/util/platform/index.js +1 -4
- package/dist/util/platform/index.js.map +1 -1
- package/dist/util/platform/linux.d.ts.map +1 -1
- package/dist/util/platform/linux.js +1 -117
- package/dist/util/platform/linux.js.map +1 -1
- package/dist/util/platform/macos.d.ts.map +1 -1
- package/dist/util/platform/macos.js +1 -4
- package/dist/util/platform/macos.js.map +1 -1
- package/dist/util/platform/posix.d.ts +0 -21
- package/dist/util/platform/posix.d.ts.map +1 -1
- package/dist/util/platform/posix.js +1 -104
- package/dist/util/platform/posix.js.map +1 -1
- package/dist/util/platform/windows.d.ts.map +1 -1
- package/dist/util/platform/windows.js +1 -107
- package/dist/util/platform/windows.js.map +1 -1
- package/dist/util/process/executable.d.ts +2 -2
- package/dist/util/process/executable.d.ts.map +1 -1
- package/dist/util/process/executable.js +31 -222
- package/dist/util/process/executable.js.map +4 -4
- package/dist/util/process/platform/contracts.d.ts +29 -0
- package/dist/util/process/platform/contracts.d.ts.map +1 -0
- package/dist/util/process/platform/contracts.js +2 -0
- package/dist/util/process/platform/contracts.js.map +1 -0
- package/dist/util/process/platform/index.d.ts +3 -0
- package/dist/util/process/platform/index.d.ts.map +1 -0
- package/dist/util/process/platform/index.js +20 -0
- package/dist/util/process/platform/index.js.map +1 -0
- package/dist/util/process/platform/linux.d.ts +3 -0
- package/dist/util/process/platform/linux.d.ts.map +1 -0
- package/dist/util/process/platform/linux.js +122 -0
- package/dist/util/process/platform/linux.js.map +1 -0
- package/dist/util/process/platform/macos.d.ts +3 -0
- package/dist/util/process/platform/macos.d.ts.map +1 -0
- package/dist/util/process/platform/macos.js +8 -0
- package/dist/util/process/platform/macos.js.map +1 -0
- package/dist/util/process/platform/posix.d.ts +25 -0
- package/dist/util/process/platform/posix.d.ts.map +1 -0
- package/dist/util/process/platform/posix.js +107 -0
- package/dist/util/process/platform/posix.js.map +1 -0
- package/dist/util/process/platform/windows.d.ts +3 -0
- package/dist/util/process/platform/windows.d.ts.map +1 -0
- package/dist/util/process/platform/windows.js +114 -0
- package/dist/util/process/platform/windows.js.map +1 -0
- package/package.json +2 -2
|
@@ -1,30 +1,17 @@
|
|
|
1
1
|
// src/util/process/executable.ts
|
|
2
2
|
import { spawn } from "node:child_process";
|
|
3
3
|
import { stat as stat2 } from "node:fs/promises";
|
|
4
|
-
import { join as
|
|
4
|
+
import { join as join3, resolve as resolve2 } from "node:path";
|
|
5
5
|
|
|
6
|
-
// src/util/platform/linux.ts
|
|
6
|
+
// src/util/process/platform/linux.ts
|
|
7
7
|
import { constants as constants2, readdirSync, readFileSync } from "node:fs";
|
|
8
8
|
import { access as access2, readdir, readFile, realpath as realpath2, stat } from "node:fs/promises";
|
|
9
|
-
import {
|
|
9
|
+
import { join } from "node:path";
|
|
10
10
|
|
|
11
|
-
// src/util/platform/posix.ts
|
|
11
|
+
// src/util/process/platform/posix.ts
|
|
12
12
|
import { execFile } from "node:child_process";
|
|
13
13
|
import { constants } from "node:fs";
|
|
14
|
-
import { access,
|
|
15
|
-
import { tmpdir } from "node:os";
|
|
16
|
-
import { join } from "node:path";
|
|
17
|
-
|
|
18
|
-
// src/util/filesystem/path-error.ts
|
|
19
|
-
var LocalPathError = class extends Error {
|
|
20
|
-
code = "unsafe_local_path";
|
|
21
|
-
constructor(message, options = {}) {
|
|
22
|
-
super(message, options);
|
|
23
|
-
this.name = "LocalPathError";
|
|
24
|
-
}
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
// src/util/platform/posix.ts
|
|
14
|
+
import { access, realpath } from "node:fs/promises";
|
|
28
15
|
var PROCESS_TABLE_TIMEOUT_MILLISECONDS = 1e3;
|
|
29
16
|
var PROCESS_TABLE_OUTPUT_LIMIT_BYTES = 1024 * 1024;
|
|
30
17
|
function parseProcessTable(output) {
|
|
@@ -104,22 +91,7 @@ function terminateProcess(child, signal) {
|
|
|
104
91
|
}
|
|
105
92
|
child.kill(signal);
|
|
106
93
|
}
|
|
107
|
-
async function removeControlSocket(path) {
|
|
108
|
-
try {
|
|
109
|
-
await unlink(path);
|
|
110
|
-
} catch (cause) {
|
|
111
|
-
if (!(cause instanceof Error) || !("code" in cause) || cause.code !== "ENOENT") {
|
|
112
|
-
throw cause;
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
94
|
var posixOperations = {
|
|
117
|
-
controlSocketPath: (installationHash) => join(tmpdir(), `mobius-${installationHash}.sock`),
|
|
118
|
-
prepareControlSocket: removeControlSocket,
|
|
119
|
-
secureControlSocket: async (path) => {
|
|
120
|
-
await chmod(path, 384);
|
|
121
|
-
},
|
|
122
|
-
removeControlSocket,
|
|
123
95
|
pathDelimiter: ":",
|
|
124
96
|
environmentValue: (environment, name) => environment[name],
|
|
125
97
|
executableExtensions: () => [""],
|
|
@@ -131,21 +103,10 @@ var posixOperations = {
|
|
|
131
103
|
executableLaunch: (command, args) => ({ command, arguments: args }),
|
|
132
104
|
spawnOptions: { detached: true, windowsHide: true },
|
|
133
105
|
signalCapturedProcesses,
|
|
134
|
-
terminateProcess
|
|
135
|
-
validatePathPermissions: async (path, directory, privateAccess, signal) => {
|
|
136
|
-
signal.throwIfAborted();
|
|
137
|
-
const metadata = await lstat(path);
|
|
138
|
-
if (process.getuid === void 0 || metadata.uid !== process.getuid()) {
|
|
139
|
-
throw new LocalPathError("Path is not user-owned");
|
|
140
|
-
}
|
|
141
|
-
if (privateAccess) {
|
|
142
|
-
await chmod(path, directory ? 448 : 384);
|
|
143
|
-
}
|
|
144
|
-
signal.throwIfAborted();
|
|
145
|
-
}
|
|
106
|
+
terminateProcess
|
|
146
107
|
};
|
|
147
108
|
|
|
148
|
-
// src/util/platform/linux.ts
|
|
109
|
+
// src/util/process/platform/linux.ts
|
|
149
110
|
function appendLinuxProcessTableEntry(entries, processId, encoded) {
|
|
150
111
|
const closingParenthesis = encoded.lastIndexOf(")");
|
|
151
112
|
if (!encoded.startsWith(`${processId.toString()} (`) || closingParenthesis < 0) {
|
|
@@ -175,7 +136,7 @@ async function readLinuxProcessTable() {
|
|
|
175
136
|
appendLinuxProcessTableEntry(
|
|
176
137
|
entries,
|
|
177
138
|
processId,
|
|
178
|
-
await readFile(
|
|
139
|
+
await readFile(join("/proc", directory.name, "stat"), "utf8")
|
|
179
140
|
);
|
|
180
141
|
} catch {
|
|
181
142
|
}
|
|
@@ -200,7 +161,7 @@ function readLinuxProcessTableSynchronously() {
|
|
|
200
161
|
appendLinuxProcessTableEntry(
|
|
201
162
|
entries,
|
|
202
163
|
processId,
|
|
203
|
-
readFileSync(
|
|
164
|
+
readFileSync(join("/proc", directory.name, "stat"), "utf8")
|
|
204
165
|
);
|
|
205
166
|
} catch {
|
|
206
167
|
}
|
|
@@ -233,7 +194,7 @@ async function readLinuxProcessTableWithFallback() {
|
|
|
233
194
|
}
|
|
234
195
|
function processExists2(processId) {
|
|
235
196
|
try {
|
|
236
|
-
const encoded = readFileSync(
|
|
197
|
+
const encoded = readFileSync(join("/proc", processId.toString(), "stat"), "utf8");
|
|
237
198
|
const closingParenthesis = encoded.lastIndexOf(")");
|
|
238
199
|
if (closingParenthesis >= 0) {
|
|
239
200
|
const processState = encoded.slice(closingParenthesis + 1).trimStart().charAt(0);
|
|
@@ -245,80 +206,25 @@ function processExists2(processId) {
|
|
|
245
206
|
}
|
|
246
207
|
return processExists(processId);
|
|
247
208
|
}
|
|
248
|
-
var
|
|
209
|
+
var linuxProcessPlatform = {
|
|
249
210
|
...posixOperations,
|
|
250
211
|
readProcessTable: readLinuxProcessTableWithFallback,
|
|
251
212
|
readProcessTableSynchronously: readLinuxProcessTableSynchronously,
|
|
252
|
-
processExists: processExists2
|
|
253
|
-
claudeCodeExecutablePaths: (environment) => {
|
|
254
|
-
const homeDirectory = environment["HOME"];
|
|
255
|
-
return homeDirectory !== void 0 && isAbsolute(homeDirectory) ? [join2(homeDirectory, ".local", "bin", "claude")] : [];
|
|
256
|
-
}
|
|
213
|
+
processExists: processExists2
|
|
257
214
|
};
|
|
258
215
|
|
|
259
|
-
// src/util/platform/macos.ts
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
// src/util/platform/claude-desktop.ts
|
|
263
|
-
import { readdirSync as readdirSync2 } from "node:fs";
|
|
264
|
-
import { join as join3 } from "node:path";
|
|
265
|
-
function installedDirectories(directory) {
|
|
266
|
-
try {
|
|
267
|
-
return readdirSync2(directory, { withFileTypes: true }).filter((entry) => entry.isDirectory()).map((entry) => entry.name);
|
|
268
|
-
} catch (cause) {
|
|
269
|
-
if (cause instanceof Error && "code" in cause && (cause.code === "ENOENT" || cause.code === "ENOTDIR" || cause.code === "EACCES")) {
|
|
270
|
-
return [];
|
|
271
|
-
}
|
|
272
|
-
throw cause;
|
|
273
|
-
}
|
|
274
|
-
}
|
|
275
|
-
function claudeDesktopExecutablePaths(roots, executablePaths) {
|
|
276
|
-
const paths = [];
|
|
277
|
-
for (const root of roots) {
|
|
278
|
-
const versions = installedDirectories(root).filter((version) => /^\d+\.\d+\.\d+$/.test(version)).toSorted((left, right) => right.localeCompare(left, "en", { numeric: true }));
|
|
279
|
-
for (const version of versions) {
|
|
280
|
-
const directory = join3(root, version);
|
|
281
|
-
const installations = [
|
|
282
|
-
directory,
|
|
283
|
-
...installedDirectories(directory).map((build) => join3(directory, build))
|
|
284
|
-
];
|
|
285
|
-
for (const installation of installations) {
|
|
286
|
-
for (const executablePath of executablePaths) {
|
|
287
|
-
paths.push(join3(installation, ...executablePath));
|
|
288
|
-
}
|
|
289
|
-
}
|
|
290
|
-
}
|
|
291
|
-
}
|
|
292
|
-
return paths;
|
|
293
|
-
}
|
|
294
|
-
|
|
295
|
-
// src/util/platform/macos.ts
|
|
296
|
-
var macosPlatform = {
|
|
216
|
+
// src/util/process/platform/macos.ts
|
|
217
|
+
var macosProcessPlatform = {
|
|
297
218
|
...posixOperations,
|
|
298
219
|
readProcessTable: () => readProcessTableWithPs("/bin/ps"),
|
|
299
220
|
readProcessTableSynchronously: () => [],
|
|
300
|
-
processExists
|
|
301
|
-
claudeCodeExecutablePaths: (environment) => {
|
|
302
|
-
const paths = ["/opt/homebrew/bin/claude", "/usr/local/bin/claude"];
|
|
303
|
-
const homeDirectory = environment["HOME"];
|
|
304
|
-
if (homeDirectory !== void 0 && isAbsolute2(homeDirectory)) {
|
|
305
|
-
paths.unshift(join4(homeDirectory, ".local", "bin", "claude"));
|
|
306
|
-
paths.push(
|
|
307
|
-
...claudeDesktopExecutablePaths(
|
|
308
|
-
[join4(homeDirectory, "Library", "Application Support", "Claude", "claude-code")],
|
|
309
|
-
[["claude.app", "Contents", "MacOS", "claude"], ["claude"]]
|
|
310
|
-
)
|
|
311
|
-
);
|
|
312
|
-
}
|
|
313
|
-
return paths;
|
|
314
|
-
}
|
|
221
|
+
processExists
|
|
315
222
|
};
|
|
316
223
|
|
|
317
|
-
// src/util/platform/windows.ts
|
|
224
|
+
// src/util/process/platform/windows.ts
|
|
318
225
|
import { execFile as execFile2 } from "node:child_process";
|
|
319
226
|
import { readFile as readFile2, realpath as realpath3 } from "node:fs/promises";
|
|
320
|
-
import { dirname, extname,
|
|
321
|
-
import { promisify } from "node:util";
|
|
227
|
+
import { dirname, extname, join as join2, resolve } from "node:path";
|
|
322
228
|
|
|
323
229
|
// src/util/process/process-error.ts
|
|
324
230
|
var ProcessExecutionError = class extends Error {
|
|
@@ -330,28 +236,10 @@ var ProcessExecutionError = class extends Error {
|
|
|
330
236
|
}
|
|
331
237
|
};
|
|
332
238
|
|
|
333
|
-
// src/util/platform/windows.ts
|
|
334
|
-
var execute = promisify(execFile2);
|
|
239
|
+
// src/util/process/platform/windows.ts
|
|
335
240
|
function environmentValue(environment, name) {
|
|
336
241
|
return Object.entries(environment).find(([key]) => key.toUpperCase() === name.toUpperCase())?.[1];
|
|
337
242
|
}
|
|
338
|
-
function desktopClaudeExecutablePaths(environment) {
|
|
339
|
-
const roots = [];
|
|
340
|
-
const localAppData = environmentValue(environment, "LOCALAPPDATA");
|
|
341
|
-
if (localAppData !== void 0 && isAbsolute3(localAppData)) {
|
|
342
|
-
const dataDirectory = join5(localAppData, "Claude-Data");
|
|
343
|
-
for (const installation of installedDirectories(dataDirectory)) {
|
|
344
|
-
if (installation.startsWith("claude_")) {
|
|
345
|
-
roots.push(join5(dataDirectory, installation, "claude-code"));
|
|
346
|
-
}
|
|
347
|
-
}
|
|
348
|
-
}
|
|
349
|
-
const appData = environmentValue(environment, "APPDATA");
|
|
350
|
-
if (appData !== void 0 && isAbsolute3(appData)) {
|
|
351
|
-
roots.push(join5(appData, "Claude", "claude-code"));
|
|
352
|
-
}
|
|
353
|
-
return claudeDesktopExecutablePaths(roots, [["claude.exe"]]);
|
|
354
|
-
}
|
|
355
243
|
function executableExtensions(executableName, environment) {
|
|
356
244
|
if (/\.[a-zA-Z0-9]+$/.test(executableName)) {
|
|
357
245
|
return [""];
|
|
@@ -410,7 +298,7 @@ function readProcessTable() {
|
|
|
410
298
|
}
|
|
411
299
|
return new Promise((resolveTable) => {
|
|
412
300
|
execFile2(
|
|
413
|
-
|
|
301
|
+
join2(systemRoot, "System32", "WindowsPowerShell", "v1.0", "powershell.exe"),
|
|
414
302
|
[
|
|
415
303
|
"-NoLogo",
|
|
416
304
|
"-NoProfile",
|
|
@@ -443,71 +331,7 @@ function terminateProcess2(child, signal) {
|
|
|
443
331
|
}
|
|
444
332
|
child.kill(signal);
|
|
445
333
|
}
|
|
446
|
-
var
|
|
447
|
-
$ErrorActionPreference = 'Stop'
|
|
448
|
-
$ProgressPreference = 'SilentlyContinue'
|
|
449
|
-
$item = Get-Item -LiteralPath $env:MOBIUS_PERMISSION_PATH -Force
|
|
450
|
-
if (($item.Attributes -band [IO.FileAttributes]::ReparsePoint) -ne 0) { throw 'Unsafe path' }
|
|
451
|
-
$sid = [Security.Principal.WindowsIdentity]::GetCurrent().User
|
|
452
|
-
$acl = $item.GetAccessControl()
|
|
453
|
-
$owner = $acl.GetOwner([Security.Principal.SecurityIdentifier])
|
|
454
|
-
if ($owner -ne $sid -and -not ($owner.Value -eq 'S-1-5-32-544' -and ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator))) { throw 'Path is not user-owned' }
|
|
455
|
-
if ($env:MOBIUS_PERMISSION_PRIVATE -eq '1') {
|
|
456
|
-
if ($item.PSIsContainer) {
|
|
457
|
-
$private = New-Object Security.AccessControl.DirectorySecurity
|
|
458
|
-
$rule = New-Object Security.AccessControl.FileSystemAccessRule($sid, 'FullControl', 'ContainerInherit,ObjectInherit', 'None', 'Allow')
|
|
459
|
-
} else {
|
|
460
|
-
$private = New-Object Security.AccessControl.FileSecurity
|
|
461
|
-
$rule = New-Object Security.AccessControl.FileSystemAccessRule($sid, 'FullControl', 'Allow')
|
|
462
|
-
}
|
|
463
|
-
$private.SetOwner($sid)
|
|
464
|
-
$private.SetAccessRuleProtection($true, $false)
|
|
465
|
-
$private.AddAccessRule($rule)
|
|
466
|
-
$item.SetAccessControl($private)
|
|
467
|
-
}
|
|
468
|
-
`;
|
|
469
|
-
var windowsPermissionsTimeoutMs = 3e4;
|
|
470
|
-
async function validatePathPermissions(path, _directory, privateAccess, signal) {
|
|
471
|
-
signal.throwIfAborted();
|
|
472
|
-
const systemRoot = environmentValue(process.env, "SystemRoot");
|
|
473
|
-
if (systemRoot === void 0) {
|
|
474
|
-
throw new LocalPathError("Windows system directory is unavailable");
|
|
475
|
-
}
|
|
476
|
-
try {
|
|
477
|
-
await execute(
|
|
478
|
-
join5(systemRoot, "System32", "WindowsPowerShell", "v1.0", "powershell.exe"),
|
|
479
|
-
[
|
|
480
|
-
"-NoLogo",
|
|
481
|
-
"-NoProfile",
|
|
482
|
-
"-NonInteractive",
|
|
483
|
-
"-EncodedCommand",
|
|
484
|
-
Buffer.from(windowsPermissions, "utf16le").toString("base64")
|
|
485
|
-
],
|
|
486
|
-
{
|
|
487
|
-
env: {
|
|
488
|
-
...process.env,
|
|
489
|
-
MOBIUS_PERMISSION_PATH: path,
|
|
490
|
-
MOBIUS_PERMISSION_PRIVATE: privateAccess ? "1" : "0"
|
|
491
|
-
},
|
|
492
|
-
windowsHide: true,
|
|
493
|
-
signal: AbortSignal.any([signal, AbortSignal.timeout(windowsPermissionsTimeoutMs)]),
|
|
494
|
-
timeout: windowsPermissionsTimeoutMs,
|
|
495
|
-
maxBuffer: 16384
|
|
496
|
-
}
|
|
497
|
-
);
|
|
498
|
-
} catch (cause) {
|
|
499
|
-
signal.throwIfAborted();
|
|
500
|
-
throw new LocalPathError("The local path permissions could not be secured", { cause });
|
|
501
|
-
}
|
|
502
|
-
}
|
|
503
|
-
var windowsPlatform = {
|
|
504
|
-
controlSocketPath: (installationHash) => `\\\\.\\pipe\\mobius-${installationHash}`,
|
|
505
|
-
prepareControlSocket: async () => {
|
|
506
|
-
},
|
|
507
|
-
secureControlSocket: async () => {
|
|
508
|
-
},
|
|
509
|
-
removeControlSocket: async () => {
|
|
510
|
-
},
|
|
334
|
+
var windowsProcessPlatform = {
|
|
511
335
|
pathDelimiter: ";",
|
|
512
336
|
environmentValue,
|
|
513
337
|
executableExtensions,
|
|
@@ -516,44 +340,29 @@ var windowsPlatform = {
|
|
|
516
340
|
spawnOptions: { detached: false, windowsHide: true },
|
|
517
341
|
signalCapturedProcesses: signalCapturedProcesses2,
|
|
518
342
|
terminateProcess: terminateProcess2,
|
|
519
|
-
validatePathPermissions,
|
|
520
343
|
readProcessTable,
|
|
521
344
|
readProcessTableSynchronously: () => [],
|
|
522
|
-
processExists
|
|
523
|
-
claudeCodeExecutablePaths: (environment) => {
|
|
524
|
-
const paths = [];
|
|
525
|
-
const userProfile = environmentValue(environment, "USERPROFILE");
|
|
526
|
-
if (userProfile !== void 0 && isAbsolute3(userProfile)) {
|
|
527
|
-
paths.push(join5(userProfile, ".local", "bin", "claude.exe"));
|
|
528
|
-
}
|
|
529
|
-
const localAppData = environmentValue(environment, "LOCALAPPDATA");
|
|
530
|
-
if (localAppData !== void 0 && isAbsolute3(localAppData)) {
|
|
531
|
-
paths.push(join5(localAppData, "Microsoft", "WinGet", "Links", "claude.exe"));
|
|
532
|
-
}
|
|
533
|
-
paths.push(...desktopClaudeExecutablePaths(environment));
|
|
534
|
-
return paths;
|
|
535
|
-
}
|
|
345
|
+
processExists
|
|
536
346
|
};
|
|
537
347
|
|
|
538
|
-
// src/util/platform/index.ts
|
|
348
|
+
// src/util/process/platform/index.ts
|
|
539
349
|
var fallbackPlatform = {
|
|
540
350
|
...posixOperations,
|
|
541
351
|
readProcessTable: () => readProcessTableWithPs("/usr/bin/ps"),
|
|
542
352
|
readProcessTableSynchronously: () => [],
|
|
543
|
-
processExists
|
|
544
|
-
claudeCodeExecutablePaths: () => []
|
|
353
|
+
processExists
|
|
545
354
|
};
|
|
546
355
|
var platforms = /* @__PURE__ */ new Map([
|
|
547
|
-
["linux",
|
|
548
|
-
["darwin",
|
|
549
|
-
["win32",
|
|
356
|
+
["linux", linuxProcessPlatform],
|
|
357
|
+
["darwin", macosProcessPlatform],
|
|
358
|
+
["win32", windowsProcessPlatform]
|
|
550
359
|
]);
|
|
551
|
-
function
|
|
360
|
+
function processPlatformSupportFor(platform) {
|
|
552
361
|
return platforms.get(platform) ?? fallbackPlatform;
|
|
553
362
|
}
|
|
554
363
|
|
|
555
364
|
// src/util/process/executable.ts
|
|
556
|
-
var hostPlatform =
|
|
365
|
+
var hostPlatform = processPlatformSupportFor(process.platform);
|
|
557
366
|
var DEFAULT_OUTPUT_LIMIT_BYTES = 16 * 1024;
|
|
558
367
|
var PROCESS_GRACEFUL_STOP_TIMEOUT_MILLISECONDS = 1e3;
|
|
559
368
|
var PROCESS_FORCED_STOP_TIMEOUT_MILLISECONDS = 5e3;
|
|
@@ -596,7 +405,7 @@ var ProcessResult = class {
|
|
|
596
405
|
async function resolveExecutablePath(requestedPath, platform = process.platform) {
|
|
597
406
|
const absoluteRequestedPath = resolve2(requestedPath);
|
|
598
407
|
try {
|
|
599
|
-
const resolvedPath = await
|
|
408
|
+
const resolvedPath = await processPlatformSupportFor(platform).resolveExecutableTarget(absoluteRequestedPath);
|
|
600
409
|
const metadata = await stat2(resolvedPath);
|
|
601
410
|
if (!metadata.isFile()) {
|
|
602
411
|
return null;
|
|
@@ -616,7 +425,7 @@ async function resolveExecutablePath(requestedPath, platform = process.platform)
|
|
|
616
425
|
}
|
|
617
426
|
}
|
|
618
427
|
async function findExecutableOnPath(executableName, environment, platform = process.platform) {
|
|
619
|
-
const support =
|
|
428
|
+
const support = processPlatformSupportFor(platform);
|
|
620
429
|
const encodedPath = support.environmentValue(environment, "PATH") ?? "";
|
|
621
430
|
const separator = support.pathDelimiter;
|
|
622
431
|
const extensions = support.executableExtensions(executableName, environment);
|
|
@@ -625,7 +434,7 @@ async function findExecutableOnPath(executableName, environment, platform = proc
|
|
|
625
434
|
continue;
|
|
626
435
|
}
|
|
627
436
|
for (const extension of extensions) {
|
|
628
|
-
const requestedPath = resolve2(
|
|
437
|
+
const requestedPath = resolve2(join3(entry, `${executableName}${extension}`));
|
|
629
438
|
const executable = await resolveExecutablePath(requestedPath, platform);
|
|
630
439
|
if (executable !== null) {
|
|
631
440
|
return executable;
|