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