graphics() and others fix catch errors
This commit is contained in:
parent
2b99e1e682
commit
b75e649a01
@ -82,6 +82,7 @@ For major (breaking) changes - **version 4, 3 and 2** - see end of page.
|
||||
|
||||
| Version | Date | Comment |
|
||||
| ------- | ---------- | --------------------------------------------------------------------------------------------------- |
|
||||
| 5.18.6 | 2023-06-28 | `graphics()` fixed catched errors (mac OS) |
|
||||
| 5.18.5 | 2023-06-26 | `cpu()` fixed parsing (mac OS) |
|
||||
| 5.18.4 | 2023-06-22 | `graphics()` fixed parsing (mac OS) |
|
||||
| 5.18.3 | 2023-06-09 | `tests` improved key handling, updated docs |
|
||||
|
||||
@ -57,6 +57,11 @@
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<th scope="row">5.18.6</th>
|
||||
<td>2023-06-28</td>
|
||||
<td><span class="code">graphics()</span> fixed catch errors (mac OS)</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">5.18.5</th>
|
||||
<td>2023-06-26</td>
|
||||
|
||||
@ -170,7 +170,7 @@
|
||||
<img class="logo" src="assets/logo.png" alt="logo">
|
||||
<div class="title">systeminformation</div>
|
||||
<div class="subtitle"><span id="typed"></span> </div>
|
||||
<div class="version">New Version: <span id="version">5.18.5</span></div>
|
||||
<div class="version">New Version: <span id="version">5.18.6</span></div>
|
||||
<button class="btn btn-light" onclick="location.href='https://github.com/sebhildebrandt/systeminformation'">View on Github <i class=" fab fa-github"></i></button>
|
||||
</div>
|
||||
<div class="down">
|
||||
|
||||
@ -137,18 +137,26 @@ function fsSize(drive, callback) {
|
||||
}
|
||||
}
|
||||
if (_linux) {
|
||||
cmd = 'export LC_ALL=C; df -lkPTx squashfs; unset LC_ALL';
|
||||
execSync('cat /proc/mounts 2>/dev/null').toString().split('\n').filter(line => {
|
||||
return line.startsWith('/');
|
||||
}).forEach((line) => {
|
||||
osMounts[line.split(' ')[0]] = line.toLowerCase().indexOf('rw') >= 0;
|
||||
});
|
||||
try {
|
||||
cmd = 'export LC_ALL=C; df -lkPTx squashfs; unset LC_ALL';
|
||||
execSync('cat /proc/mounts 2>/dev/null').toString().split('\n').filter(line => {
|
||||
return line.startsWith('/');
|
||||
}).forEach((line) => {
|
||||
osMounts[line.split(' ')[0]] = line.toLowerCase().indexOf('rw') >= 0;
|
||||
});
|
||||
} catch (e) {
|
||||
util.noop();
|
||||
}
|
||||
}
|
||||
if (_freebsd || _openbsd || _netbsd) {
|
||||
cmd = 'df -lkPT';
|
||||
execSync('mount').toString().split('\n').forEach((line) => {
|
||||
osMounts[line.split(' ')[0]] = line.toLowerCase().indexOf('read-only') === -1;
|
||||
});
|
||||
try {
|
||||
cmd = 'df -lkPT';
|
||||
execSync('mount').toString().split('\n').forEach((line) => {
|
||||
osMounts[line.split(' ')[0]] = line.toLowerCase().indexOf('read-only') === -1;
|
||||
});
|
||||
} catch (e) {
|
||||
util.noop();
|
||||
}
|
||||
}
|
||||
exec(cmd, { maxBuffer: 1024 * 1024 }, function (error, stdout) {
|
||||
let lines = filterLines(stdout);
|
||||
@ -1075,10 +1083,14 @@ function diskLayout(callback) {
|
||||
}
|
||||
} catch (e) {
|
||||
// fallback to older version of lsblk
|
||||
const out2 = execSync('export LC_ALL=C; lsblk -bPo NAME,TYPE,SIZE,FSTYPE,MOUNTPOINT,UUID,ROTA,RO,RM,LABEL,MODEL,OWNER,GROUP 2>/dev/null; unset LC_ALL').toString();
|
||||
let lines = blkStdoutToObject(out2).split('\n');
|
||||
const data = parseBlk(lines);
|
||||
devices = data.filter(item => { return (item.type === 'disk') && item.size > 0 && ((item.model !== null && item.model !== '') || (item.mount === '' && item.label === '' && item.fsType === '')); });
|
||||
try {
|
||||
const out2 = execSync('export LC_ALL=C; lsblk -bPo NAME,TYPE,SIZE,FSTYPE,MOUNTPOINT,UUID,ROTA,RO,RM,LABEL,MODEL,OWNER,GROUP 2>/dev/null; unset LC_ALL').toString();
|
||||
let lines = blkStdoutToObject(out2).split('\n');
|
||||
const data = parseBlk(lines);
|
||||
devices = data.filter(item => { return (item.type === 'disk') && item.size > 0 && ((item.model !== null && item.model !== '') || (item.mount === '' && item.label === '' && item.fsType === '')); });
|
||||
} catch (e) {
|
||||
util.noop();
|
||||
}
|
||||
}
|
||||
devices.forEach((device) => {
|
||||
let mediumType = '';
|
||||
|
||||
@ -669,39 +669,42 @@ function graphics(callback) {
|
||||
} catch (e) {
|
||||
util.noop();
|
||||
}
|
||||
stdout = execSync('defaults read /Library/Preferences/com.apple.windowserver.plist 2>/dev/null;defaults read /Library/Preferences/com.apple.windowserver.displays.plist 2>/dev/null; echo ""', { maxBuffer: 1024 * 20000 });
|
||||
const output = (stdout || '').toString();
|
||||
const obj = util.plistReader(output);
|
||||
if (obj['DisplayAnyUserSets'] && obj['DisplayAnyUserSets']['Configs'] && obj['DisplayAnyUserSets']['Configs'][0] && obj['DisplayAnyUserSets']['Configs'][0]['DisplayConfig']) {
|
||||
const current = obj['DisplayAnyUserSets']['Configs'][0]['DisplayConfig'];
|
||||
let i = 0;
|
||||
current.forEach((o) => {
|
||||
if (o['CurrentInfo'] && o['CurrentInfo']['OriginX'] !== undefined && result.displays && result.displays[i]) {
|
||||
result.displays[i].positionX = o['CurrentInfo']['OriginX'];
|
||||
}
|
||||
if (o['CurrentInfo'] && o['CurrentInfo']['OriginY'] !== undefined && result.displays && result.displays[i]) {
|
||||
result.displays[i].positionY = o['CurrentInfo']['OriginY'];
|
||||
}
|
||||
i++;
|
||||
});
|
||||
try {
|
||||
stdout = execSync('defaults read /Library/Preferences/com.apple.windowserver.plist 2>/dev/null;defaults read /Library/Preferences/com.apple.windowserver.displays.plist 2>/dev/null; echo ""', { maxBuffer: 1024 * 20000 });
|
||||
const output = (stdout || '').toString();
|
||||
const obj = util.plistReader(output);
|
||||
if (obj['DisplayAnyUserSets'] && obj['DisplayAnyUserSets']['Configs'] && obj['DisplayAnyUserSets']['Configs'][0] && obj['DisplayAnyUserSets']['Configs'][0]['DisplayConfig']) {
|
||||
const current = obj['DisplayAnyUserSets']['Configs'][0]['DisplayConfig'];
|
||||
let i = 0;
|
||||
current.forEach((o) => {
|
||||
if (o['CurrentInfo'] && o['CurrentInfo']['OriginX'] !== undefined && result.displays && result.displays[i]) {
|
||||
result.displays[i].positionX = o['CurrentInfo']['OriginX'];
|
||||
}
|
||||
if (o['CurrentInfo'] && o['CurrentInfo']['OriginY'] !== undefined && result.displays && result.displays[i]) {
|
||||
result.displays[i].positionY = o['CurrentInfo']['OriginY'];
|
||||
}
|
||||
i++;
|
||||
});
|
||||
}
|
||||
if (obj['DisplayAnyUserSets'] && obj['DisplayAnyUserSets'].length > 0 && obj['DisplayAnyUserSets'][0].length > 0 && obj['DisplayAnyUserSets'][0][0]['DisplayID']) {
|
||||
const current = obj['DisplayAnyUserSets'][0];
|
||||
let i = 0;
|
||||
current.forEach((o) => {
|
||||
if ('OriginX' in o && result.displays && result.displays[i]) {
|
||||
result.displays[i].positionX = o['OriginX'];
|
||||
}
|
||||
if ('OriginY' in o && result.displays && result.displays[i]) {
|
||||
result.displays[i].positionY = o['OriginY'];
|
||||
}
|
||||
if (o['Mode'] && o['Mode']['BitsPerPixel'] !== undefined && result.displays && result.displays[i]) {
|
||||
result.displays[i].pixelDepth = o['Mode']['BitsPerPixel'];
|
||||
}
|
||||
i++;
|
||||
});
|
||||
}
|
||||
} catch (e) {
|
||||
util.noop();
|
||||
}
|
||||
if (obj['DisplayAnyUserSets'] && obj['DisplayAnyUserSets'].length > 0 && obj['DisplayAnyUserSets'][0].length > 0 && obj['DisplayAnyUserSets'][0][0]['DisplayID']) {
|
||||
const current = obj['DisplayAnyUserSets'][0];
|
||||
let i = 0;
|
||||
current.forEach((o) => {
|
||||
if ('OriginX' in o && result.displays && result.displays[i]) {
|
||||
result.displays[i].positionX = o['OriginX'];
|
||||
}
|
||||
if ('OriginY' in o && result.displays && result.displays[i]) {
|
||||
result.displays[i].positionY = o['OriginY'];
|
||||
}
|
||||
if (o['Mode'] && o['Mode']['BitsPerPixel'] !== undefined && result.displays && result.displays[i]) {
|
||||
result.displays[i].pixelDepth = o['Mode']['BitsPerPixel'];
|
||||
}
|
||||
i++;
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
if (callback) {
|
||||
callback(result);
|
||||
|
||||
@ -788,23 +788,28 @@ function versions(apps, callback) {
|
||||
}
|
||||
if ({}.hasOwnProperty.call(appsObj.versions, 'python')) {
|
||||
if (_darwin) {
|
||||
const stdout = execSync('sw_vers');
|
||||
const lines = stdout.toString().split('\n');
|
||||
const osVersion = util.getValue(lines, 'ProductVersion', ':');
|
||||
const gitHomebrewExists1 = fs.existsSync('/usr/local/Cellar/python');
|
||||
const gitHomebrewExists2 = fs.existsSync('/opt/homebrew/bin/python');
|
||||
if ((util.darwinXcodeExists() && util.semverCompare('12.0.1', osVersion) < 0) || gitHomebrewExists1 || gitHomebrewExists2) {
|
||||
const cmd = gitHomebrewExists1 ? '/usr/local/Cellar/python -V 2>&1' : (gitHomebrewExists2 ? '/opt/homebrew/bin/python -V 2>&1' : 'python -V 2>&1');
|
||||
exec(cmd, function (error, stdout) {
|
||||
if (!error) {
|
||||
const python = stdout.toString().split('\n')[0] || '';
|
||||
appsObj.versions.python = python.toLowerCase().replace('python', '').trim();
|
||||
}
|
||||
try {
|
||||
const stdout = execSync('sw_vers');
|
||||
const lines = stdout.toString().split('\n');
|
||||
const osVersion = util.getValue(lines, 'ProductVersion', ':');
|
||||
const gitHomebrewExists1 = fs.existsSync('/usr/local/Cellar/python');
|
||||
const gitHomebrewExists2 = fs.existsSync('/opt/homebrew/bin/python');
|
||||
if ((util.darwinXcodeExists() && util.semverCompare('12.0.1', osVersion) < 0) || gitHomebrewExists1 || gitHomebrewExists2) {
|
||||
const cmd = gitHomebrewExists1 ? '/usr/local/Cellar/python -V 2>&1' : (gitHomebrewExists2 ? '/opt/homebrew/bin/python -V 2>&1' : 'python -V 2>&1');
|
||||
exec(cmd, function (error, stdout) {
|
||||
if (!error) {
|
||||
const python = stdout.toString().split('\n')[0] || '';
|
||||
appsObj.versions.python = python.toLowerCase().replace('python', '').trim();
|
||||
}
|
||||
functionProcessed();
|
||||
});
|
||||
} else {
|
||||
functionProcessed();
|
||||
});
|
||||
} else {
|
||||
}
|
||||
} catch (e) {
|
||||
functionProcessed();
|
||||
}
|
||||
|
||||
} else {
|
||||
exec('python -V 2>&1', function (error, stdout) {
|
||||
if (!error) {
|
||||
|
||||
@ -586,8 +586,12 @@ function smartMonToolsInstalled() {
|
||||
}
|
||||
}
|
||||
if (_linux || _darwin || _freebsd || _openbsd || _netbsd) {
|
||||
const pathArray = execSync('which smartctl 2>/dev/null', execOptsWin).toString().split('\r\n');
|
||||
_smartMonToolsInstalled = pathArray.length > 0;
|
||||
try {
|
||||
const pathArray = execSync('which smartctl 2>/dev/null', execOptsWin).toString().split('\r\n');
|
||||
_smartMonToolsInstalled = pathArray.length > 0;
|
||||
} catch (e) {
|
||||
util.noop();
|
||||
}
|
||||
}
|
||||
return _smartMonToolsInstalled;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user