(cmd)
| 154 | } |
| 155 | |
| 156 | const getWslVersion = (cmd) => { |
| 157 | const defaultVersion = 1 |
| 158 | try { |
| 159 | const opts = { shell: cmd, env: process.env } |
| 160 | const wsl = spawnPath('wslpath', [`'${which('wsl')}'`], opts).stdout |
| 161 | const distrosRaw = spawnPath(wsl, ['-l', '-v'], { ...opts, stdioString: false }).stdout |
| 162 | const distros = spawnPath('iconv', ['-f', 'unicode'], { ...opts, input: distrosRaw }).stdout |
| 163 | const distroArgs = distros |
| 164 | .replace(/\r\n/g, '\n') |
| 165 | .split('\n') |
| 166 | .slice(1) |
| 167 | .find(d => d.startsWith('*')) |
| 168 | .replace(/\s+/g, ' ') |
| 169 | .split(' ') |
| 170 | return Number(distroArgs[distroArgs.length - 1]) || defaultVersion |
| 171 | } catch { |
| 172 | return defaultVersion |
| 173 | } |
| 174 | } |
| 175 | |
| 176 | for (const shim of Object.keys(SHIMS)) { |
| 177 | chmodSync(join(path, shim), 0o755) |
no test coverage detected