diff --git a/index.js b/index.js index 5690e3e..7d01869 100644 --- a/index.js +++ b/index.js @@ -146,28 +146,32 @@ async function installerBlobs() { currentVersion = '1.18.1!'; } images = await fetchWorkspaceList(currentVersion, arch); - let gpuData = []; - let gpuCmd = spawn('/gpuinfo.sh'); - gpuCmd.stdout.on('data', function(data) { - gpuData.push(data); - }); - gpuCmd.on('close', function(code) { - try { - if (code == 0) { - gpuInfo = JSON.parse(gpuData.join('')); - } else { + gpuInfo = {}; + await new Promise((resolve) => { + let gpuData = []; + let gpuCmd = spawn('/gpuinfo.sh'); + gpuCmd.stdout.on('data', function(data) { + gpuData.push(data); + }); + gpuCmd.on('close', function(code) { + try { + if (code == 0) { + gpuInfo = JSON.parse(gpuData.join('')); + } else { + gpuInfo = {}; + } + } catch (err) { + // Manually backfill GPU info if available gpuInfo = {}; - } - } catch (err) { - // Manually backfill GPU info if available - gpuInfo = {}; - for (let i = 0; i < 10; i++) { - let num = i.toString(); - if (fs.existsSync('/dev/dri/card' + num)) { - gpuInfo['/dev/dri/card' + num] = "Unknown GPU"; + for (let i = 0; i < 10; i++) { + let num = i.toString(); + if (fs.existsSync('/dev/dri/card' + num)) { + gpuInfo['/dev/dri/card' + num] = "Unknown GPU"; + } } } - } + resolve(); + }); }); } installerBlobs(); diff --git a/public/js/index.js b/public/js/index.js index 62e1b7a..e135856 100644 --- a/public/js/index.js +++ b/public/js/index.js @@ -93,7 +93,7 @@ function renderInstall(data) { titleChange('EULA'); EULA = data[0]; images = data[1]; - gpus = data[2]; + gpus = data[2] || {}; versionChange(data[3], data[4]); let EULADiv = $('