(platform: NodeJS.Platform, currentPath: string | undefined, nodeBin: string)
| 1108 | } |
| 1109 | |
| 1110 | function 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 | |
| 1130 | function quoteSystemdExecStart(command: string, args: string[]): string { |
| 1131 | return [command, ...args].map(quoteSystemdArg).join(' '); |
no test coverage detected