Merge pull request #3 from kasmtech/bugfix/KASM-3699-fix-gpu-info-error

KASM-3699 have a fallback mode for gpuinfo script to simply list the cards
This commit is contained in:
j-travis 2022-12-05 17:58:44 -05:00 committed by GitHub
commit 3e9264d25d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -39,10 +39,21 @@ async function installerBlobs() {
gpuData.push(data);
});
gpuCmd.on('close', function(code) {
if (code == 0) {
gpuInfo = JSON.parse(gpuData.join(''));
} else {
try {
if (code == 0) {
gpuInfo = JSON.parse(gpuData.join(''));
} else {
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";
}
}
}
});
}