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 |
|
| 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.5 | 2023-06-26 | `cpu()` fixed parsing (mac OS) |
|
||||||
| 5.18.4 | 2023-06-22 | `graphics()` 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 |
|
| 5.18.3 | 2023-06-09 | `tests` improved key handling, updated docs |
|
||||||
|
|||||||
@ -57,6 +57,11 @@
|
|||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<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>
|
<tr>
|
||||||
<th scope="row">5.18.5</th>
|
<th scope="row">5.18.5</th>
|
||||||
<td>2023-06-26</td>
|
<td>2023-06-26</td>
|
||||||
|
|||||||
@ -170,7 +170,7 @@
|
|||||||
<img class="logo" src="assets/logo.png" alt="logo">
|
<img class="logo" src="assets/logo.png" alt="logo">
|
||||||
<div class="title">systeminformation</div>
|
<div class="title">systeminformation</div>
|
||||||
<div class="subtitle"><span id="typed"></span> </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>
|
<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>
|
||||||
<div class="down">
|
<div class="down">
|
||||||
|
|||||||
@ -137,18 +137,26 @@ function fsSize(drive, callback) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (_linux) {
|
if (_linux) {
|
||||||
cmd = 'export LC_ALL=C; df -lkPTx squashfs; unset LC_ALL';
|
try {
|
||||||
execSync('cat /proc/mounts 2>/dev/null').toString().split('\n').filter(line => {
|
cmd = 'export LC_ALL=C; df -lkPTx squashfs; unset LC_ALL';
|
||||||
return line.startsWith('/');
|
execSync('cat /proc/mounts 2>/dev/null').toString().split('\n').filter(line => {
|
||||||
}).forEach((line) => {
|
return line.startsWith('/');
|
||||||
osMounts[line.split(' ')[0]] = line.toLowerCase().indexOf('rw') >= 0;
|
}).forEach((line) => {
|
||||||
});
|
osMounts[line.split(' ')[0]] = line.toLowerCase().indexOf('rw') >= 0;
|
||||||
|
});
|
||||||
|
} catch (e) {
|
||||||
|
util.noop();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (_freebsd || _openbsd || _netbsd) {
|
if (_freebsd || _openbsd || _netbsd) {
|
||||||
cmd = 'df -lkPT';
|
try {
|
||||||
execSync('mount').toString().split('\n').forEach((line) => {
|
cmd = 'df -lkPT';
|
||||||
osMounts[line.split(' ')[0]] = line.toLowerCase().indexOf('read-only') === -1;
|
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) {
|
exec(cmd, { maxBuffer: 1024 * 1024 }, function (error, stdout) {
|
||||||
let lines = filterLines(stdout);
|
let lines = filterLines(stdout);
|
||||||
@ -1075,10 +1083,14 @@ function diskLayout(callback) {
|
|||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
// fallback to older version of lsblk
|
// 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();
|
try {
|
||||||
let lines = blkStdoutToObject(out2).split('\n');
|
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();
|
||||||
const data = parseBlk(lines);
|
let lines = blkStdoutToObject(out2).split('\n');
|
||||||
devices = data.filter(item => { return (item.type === 'disk') && item.size > 0 && ((item.model !== null && item.model !== '') || (item.mount === '' && item.label === '' && item.fsType === '')); });
|
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) => {
|
devices.forEach((device) => {
|
||||||
let mediumType = '';
|
let mediumType = '';
|
||||||
|
|||||||
@ -669,39 +669,42 @@ function graphics(callback) {
|
|||||||
} catch (e) {
|
} catch (e) {
|
||||||
util.noop();
|
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 });
|
try {
|
||||||
const output = (stdout || '').toString();
|
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 obj = util.plistReader(output);
|
const output = (stdout || '').toString();
|
||||||
if (obj['DisplayAnyUserSets'] && obj['DisplayAnyUserSets']['Configs'] && obj['DisplayAnyUserSets']['Configs'][0] && obj['DisplayAnyUserSets']['Configs'][0]['DisplayConfig']) {
|
const obj = util.plistReader(output);
|
||||||
const current = obj['DisplayAnyUserSets']['Configs'][0]['DisplayConfig'];
|
if (obj['DisplayAnyUserSets'] && obj['DisplayAnyUserSets']['Configs'] && obj['DisplayAnyUserSets']['Configs'][0] && obj['DisplayAnyUserSets']['Configs'][0]['DisplayConfig']) {
|
||||||
let i = 0;
|
const current = obj['DisplayAnyUserSets']['Configs'][0]['DisplayConfig'];
|
||||||
current.forEach((o) => {
|
let i = 0;
|
||||||
if (o['CurrentInfo'] && o['CurrentInfo']['OriginX'] !== undefined && result.displays && result.displays[i]) {
|
current.forEach((o) => {
|
||||||
result.displays[i].positionX = o['CurrentInfo']['OriginX'];
|
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'];
|
if (o['CurrentInfo'] && o['CurrentInfo']['OriginY'] !== undefined && result.displays && result.displays[i]) {
|
||||||
}
|
result.displays[i].positionY = o['CurrentInfo']['OriginY'];
|
||||||
i++;
|
}
|
||||||
});
|
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) {
|
if (callback) {
|
||||||
callback(result);
|
callback(result);
|
||||||
|
|||||||
@ -788,23 +788,28 @@ function versions(apps, callback) {
|
|||||||
}
|
}
|
||||||
if ({}.hasOwnProperty.call(appsObj.versions, 'python')) {
|
if ({}.hasOwnProperty.call(appsObj.versions, 'python')) {
|
||||||
if (_darwin) {
|
if (_darwin) {
|
||||||
const stdout = execSync('sw_vers');
|
try {
|
||||||
const lines = stdout.toString().split('\n');
|
const stdout = execSync('sw_vers');
|
||||||
const osVersion = util.getValue(lines, 'ProductVersion', ':');
|
const lines = stdout.toString().split('\n');
|
||||||
const gitHomebrewExists1 = fs.existsSync('/usr/local/Cellar/python');
|
const osVersion = util.getValue(lines, 'ProductVersion', ':');
|
||||||
const gitHomebrewExists2 = fs.existsSync('/opt/homebrew/bin/python');
|
const gitHomebrewExists1 = fs.existsSync('/usr/local/Cellar/python');
|
||||||
if ((util.darwinXcodeExists() && util.semverCompare('12.0.1', osVersion) < 0) || gitHomebrewExists1 || gitHomebrewExists2) {
|
const gitHomebrewExists2 = fs.existsSync('/opt/homebrew/bin/python');
|
||||||
const cmd = gitHomebrewExists1 ? '/usr/local/Cellar/python -V 2>&1' : (gitHomebrewExists2 ? '/opt/homebrew/bin/python -V 2>&1' : 'python -V 2>&1');
|
if ((util.darwinXcodeExists() && util.semverCompare('12.0.1', osVersion) < 0) || gitHomebrewExists1 || gitHomebrewExists2) {
|
||||||
exec(cmd, function (error, stdout) {
|
const cmd = gitHomebrewExists1 ? '/usr/local/Cellar/python -V 2>&1' : (gitHomebrewExists2 ? '/opt/homebrew/bin/python -V 2>&1' : 'python -V 2>&1');
|
||||||
if (!error) {
|
exec(cmd, function (error, stdout) {
|
||||||
const python = stdout.toString().split('\n')[0] || '';
|
if (!error) {
|
||||||
appsObj.versions.python = python.toLowerCase().replace('python', '').trim();
|
const python = stdout.toString().split('\n')[0] || '';
|
||||||
}
|
appsObj.versions.python = python.toLowerCase().replace('python', '').trim();
|
||||||
|
}
|
||||||
|
functionProcessed();
|
||||||
|
});
|
||||||
|
} else {
|
||||||
functionProcessed();
|
functionProcessed();
|
||||||
});
|
}
|
||||||
} else {
|
} catch (e) {
|
||||||
functionProcessed();
|
functionProcessed();
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
exec('python -V 2>&1', function (error, stdout) {
|
exec('python -V 2>&1', function (error, stdout) {
|
||||||
if (!error) {
|
if (!error) {
|
||||||
|
|||||||
@ -586,8 +586,12 @@ function smartMonToolsInstalled() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (_linux || _darwin || _freebsd || _openbsd || _netbsd) {
|
if (_linux || _darwin || _freebsd || _openbsd || _netbsd) {
|
||||||
const pathArray = execSync('which smartctl 2>/dev/null', execOptsWin).toString().split('\r\n');
|
try {
|
||||||
_smartMonToolsInstalled = pathArray.length > 0;
|
const pathArray = execSync('which smartctl 2>/dev/null', execOptsWin).toString().split('\r\n');
|
||||||
|
_smartMonToolsInstalled = pathArray.length > 0;
|
||||||
|
} catch (e) {
|
||||||
|
util.noop();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return _smartMonToolsInstalled;
|
return _smartMonToolsInstalled;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user