minor fixes
This commit is contained in:
+10
-1
@@ -212,12 +212,18 @@ exports.networkInterfaceDefault = networkInterfaceDefault;
|
||||
function parseLinesWindowsNics(sections, nconfigsections) {
|
||||
let nics = [];
|
||||
for (let i in sections) {
|
||||
try {
|
||||
if ({}.hasOwnProperty.call(sections, i)) {
|
||||
|
||||
if (sections[i].trim() !== '') {
|
||||
|
||||
let lines = sections[i].trim().split('\r\n');
|
||||
let linesNicConfig = nconfigsections && nconfigsections[i] ? nconfigsections[i].trim().split('\r\n') : [];
|
||||
let linesNicConfig = null;
|
||||
try {
|
||||
linesNicConfig = nconfigsections && nconfigsections[i] ? nconfigsections[i].trim().split('\r\n') : [];
|
||||
} catch (e) {
|
||||
util.noop();
|
||||
}
|
||||
let netEnabled = util.getValue(lines, 'NetEnabled', ':');
|
||||
let adapterType = util.getValue(lines, 'AdapterTypeID', ':') === '9' ? 'wireless' : 'wired';
|
||||
let ifacename = util.getValue(lines, 'Name', ':').replace(/\]/g, ')').replace(/\[/g, '(');
|
||||
@@ -240,6 +246,9 @@ function parseLinesWindowsNics(sections, nconfigsections) {
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
util.noop();
|
||||
}
|
||||
}
|
||||
return nics;
|
||||
}
|
||||
|
||||
+2
-2
@@ -579,7 +579,7 @@ function getCodepage() {
|
||||
if (_linux || _darwin || _freebsd || _openbsd || _netbsd) {
|
||||
if (!codepage) {
|
||||
try {
|
||||
const stdout = execSync('echo $LANG', util.execOptsLinux);
|
||||
const stdout = execSync('echo $LANG', execOptsLinux);
|
||||
const lines = stdout.toString().split('\r\n');
|
||||
const parts = lines[0].split('.');
|
||||
codepage = parts.length > 1 ? parts[1].trim() : '';
|
||||
@@ -1156,7 +1156,7 @@ function linuxVersion() {
|
||||
let result = '';
|
||||
if (_linux) {
|
||||
try {
|
||||
result = execSync('uname -v', util.execOptsLinux).toString();
|
||||
result = execSync('uname -v', execOptsLinux).toString();
|
||||
} catch (e) {
|
||||
result = '';
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user