mirror of
https://github.com/compiler-explorer/compiler-explorer.git
synced 2025-12-27 10:33:59 -05:00
Fix WSL for systems that don't have windows paths (#5480)
Attempt to fix #5476. As far as I can tell `process.env.winTmp` is needed just for windows executables and WslVcCompiler. It should be possible to just ignore the exec error and continue. If for some reason the user doesn't have windows paths in their WSL but does want to run windows executables they can pass `-tmpDir`.
This commit is contained in:
12
app.ts
12
app.ts
@@ -156,10 +156,14 @@ if (opts.tmpDir) {
|
||||
} else if (process.env.wsl) {
|
||||
// Dec 2017 preview builds of WSL include /bin/wslpath; do the parsing work for now.
|
||||
// Parsing example %TEMP% is C:\Users\apardoe\AppData\Local\Temp
|
||||
const windowsTemp = child_process.execSync('cmd.exe /c echo %TEMP%').toString().replaceAll('\\', '/');
|
||||
const driveLetter = windowsTemp.substring(0, 1).toLowerCase();
|
||||
const directoryPath = windowsTemp.substring(2).trim();
|
||||
process.env.winTmp = path.join('/mnt', driveLetter, directoryPath);
|
||||
try {
|
||||
const windowsTemp = child_process.execSync('cmd.exe /c echo %TEMP%').toString().replaceAll('\\', '/');
|
||||
const driveLetter = windowsTemp.substring(0, 1).toLowerCase();
|
||||
const directoryPath = windowsTemp.substring(2).trim();
|
||||
process.env.winTmp = path.join('/mnt', driveLetter, directoryPath);
|
||||
} catch (e) {
|
||||
logger.warn('Unable to invoke cmd.exe to get windows %TEMP% path.');
|
||||
}
|
||||
}
|
||||
|
||||
const distPath = utils.resolvePathFromAppRoot('.');
|
||||
|
||||
Reference in New Issue
Block a user