Open TheRedfoox opened 5 months ago
After putting a few debuggers in the code, I realize that getNvidiaSmi() is in error
Line 397: Error: ENOTDIR: not a directory, scandir 'C:\WINDOWS\System32\DriverStore\FileRepository/a-volutenh3aposwc.inf_amd64_b9b81cb814cdca75.ini'
at Object.readdirSync (VM262 node:fs:1527:3)
at t.readdirSync (VM340 node_init:2:11289)
at VM369 G:\Developer\sb-hardware-monitor\node_modules\systeminformation\lib\graphics.js:398:21
at Array.filter (<anonymous>)
at getNvidiaSmi (VM369 G:\Developer\sb-hardware-monitor\node_modules\systeminformation\lib\graphics.js:397:56)
at nvidiaSmi (VM369 G:\Developer\sb-hardware-monitor\node_modules\systeminformation\lib\graphics.js:420:26)
at nvidiaDevices (VM369 G:\Developer\sb-hardware-monitor\node_modules\systeminformation\lib\graphics.js:444:20)
at VM369 G:\Developer\sb-hardware-monitor\node_modules\systeminformation\lib\graphics.js:837:30
at process.processTicksAndRejections (VM225 task_queues:77:11)
With even more searching, I see that fs.readdirSync(basePath)
would expect to have only directories but actually with my explorer here C:\Windows\System32\DriverStore\FileRepository
I see .ini's which may have the same name as some folders.
I think that since Windows 24H2 there are files in FileRepository, which wasn't the case before and which now poses a problem.
Something like this should solve the problem by simply checking whether the element we're testing is actually a directory.
const candidateDirs = fs.readdirSync(basePath).filter(dir => {
if (fs.statSync([basePath, dir].join('/')).isDirectory()) {
return fs.readdirSync([basePath, dir].join('/')).includes('nvidia-smi.exe');
}
});
I don't know if it's up to me to make a pull request or how to format it to propose this change to fix this problem on Windows 24H2. In any case, I'm available to fix this problem as soon as possible.
Describe the bug Since the Windows 24H2 update, almost no GPU metrics (usage, temperature, power, etc.) come up. However, on another PC running Windows 23H2, the metrics come back correctly.
To Reproduce Steps to reproduce the behavior:
systeminformation.graphics()
.Current Output GPU metrics (usage, temperature, power, etc.) are not available.
Expected behavior GPU metrics (usage, temperature, power, etc.) should be available, as they are on a Windows 23H2 PC.
Environment (please complete the following information):
To get all needed environment information, please run the following command:
Additional context This problem appeared after the Windows 24H2 update. On another PC running Windows 23H2, GPU metrics are correctly displayed.