(key, text)
| 37 | |
| 38 | /** Extract a short version string from a tool's --version output. Pure. */ |
| 39 | export function parseToolVersion(key, text) { |
| 40 | if (!text) return null; |
| 41 | const t = String(text); |
| 42 | if (key === "java") { |
| 43 | const m = t.match(/version\s+"?([\d._]+)"?/i); |
| 44 | if (m) return m[1]; |
| 45 | } |
| 46 | if (key === "node") { |
| 47 | const m = t.match(/v?(\d+\.\d+\.\d+)/); |
| 48 | if (m) return m[1]; |
| 49 | } |
| 50 | const g = t.match(/(\d+\.\d+(?:\.\d+)?)/); |
| 51 | if (g) return g[1]; |
| 52 | const first = t.split(/\r?\n/)[0].trim(); |
| 53 | return first ? first.slice(0, 40) : null; |
| 54 | } |
| 55 | |
| 56 | function defaultExec(cmd, args) { |
| 57 | return makeExec(augmentedEnv(process.env, platform()))(cmd, args); |
no outgoing calls
no test coverage detected