| 21 | } |
| 22 | |
| 23 | function parseCmdSetOutput(output) { |
| 24 | const next = {}; |
| 25 | for (const raw of output.split(/\r?\n/)) { |
| 26 | const line = raw.trimEnd(); |
| 27 | if (line.length === 0) continue; |
| 28 | const idx = line.indexOf("="); |
| 29 | if (idx <= 0) continue; |
| 30 | const key = line.slice(0, idx); |
| 31 | // cmd.exe prints internal per-drive cwd entries like `=C:=C:\...`. |
| 32 | if (key.startsWith("=")) continue; |
| 33 | next[key] = line.slice(idx + 1); |
| 34 | } |
| 35 | return next; |
| 36 | } |
| 37 | |
| 38 | function runBatchAndGetEnv(batchFile, batchArgs, env) { |
| 39 | const args = Array.isArray(batchArgs) ? batchArgs : []; |