codepage() defaults linux, osInfo() serial (linux)
This commit is contained in:
parent
5de7801070
commit
6d2218059e
@ -207,11 +207,14 @@ function osInfo(callback) {
|
|||||||
result.release = (releaseVersion || release.DISTRIB_RELEASE || release.VERSION_ID || 'unknown').replace(/"/g, '');
|
result.release = (releaseVersion || release.DISTRIB_RELEASE || release.VERSION_ID || 'unknown').replace(/"/g, '');
|
||||||
result.codename = codename;
|
result.codename = codename;
|
||||||
result.codepage = util.getCodepage();
|
result.codepage = util.getCodepage();
|
||||||
|
uuid().then(data => {
|
||||||
|
result.serial = data.os;
|
||||||
|
if (callback) {
|
||||||
|
callback(result);
|
||||||
|
}
|
||||||
|
resolve(result);
|
||||||
|
})
|
||||||
//}
|
//}
|
||||||
if (callback) {
|
|
||||||
callback(result);
|
|
||||||
}
|
|
||||||
resolve(result);
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
if (_freebsd || _openbsd) {
|
if (_freebsd || _openbsd) {
|
||||||
|
|||||||
15
lib/util.js
15
lib/util.js
@ -260,17 +260,12 @@ function getCodepage() {
|
|||||||
if (_linux || _darwin || _freebsd || _openbsd) {
|
if (_linux || _darwin || _freebsd || _openbsd) {
|
||||||
if (!codepage) {
|
if (!codepage) {
|
||||||
try {
|
try {
|
||||||
const stdout = execSync('locale charmap');
|
const stdout = execSync('echo $LANG');
|
||||||
let lines = stdout.toString().split('\r\n');
|
lines = stdout.toString().split('\r\n');
|
||||||
codepage = lines[0].trim();
|
const parts = lines[0].split('.');
|
||||||
|
codepage = parts.length > 1 ? parts[1].trim() : '';
|
||||||
if (!codepage) {
|
if (!codepage) {
|
||||||
const stdout = execSync('echo $LANG');
|
codepage = 'UTF-8';
|
||||||
lines = stdout.toString().split('\r\n');
|
|
||||||
const parts = lines[0].split('.');
|
|
||||||
codepage = parts.length > 1 ? parts[1].trim() : '';
|
|
||||||
if (!codepage) {
|
|
||||||
codepage = 'UTF-8';
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
codepage = 'UTF-8';
|
codepage = 'UTF-8';
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user