(exec)
| 7 | |
| 8 | const executor = { |
| 9 | async windows (exec) { |
| 10 | const ret = await exec(['set'], { type: 'cmd' }) |
| 11 | const map = {} |
| 12 | if (ret != null) { |
| 13 | const lines = ret.split('\r\n') |
| 14 | for (const item of lines) { |
| 15 | const kv = item.split('=') |
| 16 | if (kv.length > 1) { |
| 17 | map[kv[0].trim()] = kv[1].trim() |
| 18 | } |
| 19 | } |
| 20 | } |
| 21 | return map |
| 22 | }, |
| 23 | async linux (exec, { port }) { |
| 24 | throw new Error('暂未实现此功能') |
| 25 | }, |