MCPcopy
hub / github.com/openai/codex-plugin-cc / binaryAvailable

Function binaryAvailable

plugins/codex/scripts/lib/process.mjs:38–51  ·  view source on GitHub ↗
(command, versionArgs = ["--version"], options = {})

Source from the content-addressed store, hash-verified

36}
37
38export function binaryAvailable(command, versionArgs = ["--version"], options = {}) {
39 const result = runCommand(command, versionArgs, options);
40 if (result.error && /** @type {NodeJS.ErrnoException} */ (result.error).code === "ENOENT") {
41 return { available: false, detail: "not found" };
42 }
43 if (result.error) {
44 return { available: false, detail: result.error.message };
45 }
46 if (result.status !== 0) {
47 const detail = result.stderr.trim() || result.stdout.trim() || `exit ${result.status}`;
48 return { available: false, detail };
49 }
50 return { available: true, detail: result.stdout.trim() || result.stderr.trim() || "ok" };
51}
52
53function looksLikeMissingProcessMessage(text) {
54 return /not found|no running instance|cannot find|does not exist|no such process/i.test(text);

Callers 2

buildSetupReportFunction · 0.90
getCodexAvailabilityFunction · 0.90

Calls 1

runCommandFunction · 0.85

Tested by

no test coverage detected