diff --git a/lib/osinfo.js b/lib/osinfo.js index 9d94491..c65c452 100644 --- a/lib/osinfo.js +++ b/lib/osinfo.js @@ -207,11 +207,14 @@ function osInfo(callback) { result.release = (releaseVersion || release.DISTRIB_RELEASE || release.VERSION_ID || 'unknown').replace(/"/g, ''); result.codename = codename; 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) { diff --git a/lib/util.js b/lib/util.js index 01cdccb..5cc5c1e 100644 --- a/lib/util.js +++ b/lib/util.js @@ -260,17 +260,12 @@ function getCodepage() { if (_linux || _darwin || _freebsd || _openbsd) { if (!codepage) { try { - const stdout = execSync('locale charmap'); - let lines = stdout.toString().split('\r\n'); - codepage = lines[0].trim(); + const stdout = execSync('echo $LANG'); + lines = stdout.toString().split('\r\n'); + const parts = lines[0].split('.'); + codepage = parts.length > 1 ? parts[1].trim() : ''; if (!codepage) { - const stdout = execSync('echo $LANG'); - lines = stdout.toString().split('\r\n'); - const parts = lines[0].split('.'); - codepage = parts.length > 1 ? parts[1].trim() : ''; - if (!codepage) { - codepage = 'UTF-8'; - } + codepage = 'UTF-8'; } } catch (err) { codepage = 'UTF-8';