(exec, { certPath })
| 5 | |
| 6 | const executor = { |
| 7 | async windows (exec, { certPath }) { |
| 8 | if (!certPath) { |
| 9 | throw new Error('证书路径为空,无法安装根证书。请确认证书文件已生成。') |
| 10 | } |
| 11 | if (!fs.existsSync(certPath)) { |
| 12 | throw new Error(`证书文件不存在: ${certPath}`) |
| 13 | } |
| 14 | const cmds = [`start "" "${certPath}"`] |
| 15 | await exec(cmds, { type: 'cmd' }) |
| 16 | return true |
| 17 | }, |
| 18 | async linux (exec, { certPath }) { |
| 19 | if (!certPath) { |
| 20 | throw new Error('证书路径为空,无法安装根证书。请确认证书文件已生成。') |