MCPcopy Create free account
hub / github.com/Gan-Xing/CodexBridge / buildServicePathEnv

Function buildServicePathEnv

packages/codex-native-api/src/daemon_manager.ts:1110–1128  ·  view source on GitHub ↗
(platform: NodeJS.Platform, currentPath: string | undefined, nodeBin: string)

Source from the content-addressed store, hash-verified

1108}
1109
1110function buildServicePathEnv(platform: NodeJS.Platform, currentPath: string | undefined, nodeBin: string): string {
1111 const parts = new Set<string>();
1112 const nodeDir = path.dirname(nodeBin);
1113 if (nodeDir) {
1114 parts.add(nodeDir);
1115 }
1116 String(currentPath ?? '').split(path.delimiter).forEach((entry) => {
1117 const normalized = normalizeString(entry);
1118 if (normalized) {
1119 parts.add(normalized);
1120 }
1121 });
1122 if (platform === 'darwin') {
1123 ['/opt/homebrew/bin', '/usr/local/bin', '/usr/bin', '/bin', '/usr/sbin', '/sbin'].forEach((entry) => parts.add(entry));
1124 } else if (platform === 'linux') {
1125 ['/usr/local/sbin', '/usr/local/bin', '/usr/sbin', '/usr/bin', '/sbin', '/bin'].forEach((entry) => parts.add(entry));
1126 }
1127 return Array.from(parts).join(path.delimiter);
1128}
1129
1130function quoteSystemdExecStart(command: string, args: string[]): string {
1131 return [command, ...args].map(quoteSystemdArg).join(' ');

Callers 1

buildDaemonInstallPlanFunction · 0.85

Calls 1

normalizeStringFunction · 0.70

Tested by

no test coverage detected