bsd fixes

This commit is contained in:
Sebastian Hildebrandt 2021-01-19 22:04:04 +01:00
parent c88315a504
commit 44744b77cd
3 changed files with 28 additions and 5 deletions

View File

@ -760,12 +760,12 @@ function graphics(callback) {
}
}
if (_freebsd || _openbsd || _netbsd) {
if (callback) { callback(result); }
resolve(result);
if (callback) { callback(null); }
resolve(null);
}
if (_sunos) {
if (callback) { callback(result); }
resolve(result);
if (callback) { callback(null); }
resolve(null);
}
if (_windows) {

View File

@ -1020,7 +1020,7 @@ function processLoad(proc, callback) {
}
}
if (_darwin || _linux) {
if (_darwin || _linux || _freebsd || _openbsd || _netbsd) {
const params = '-axo pid,pcpu,pmem,comm';
execFile('ps', params.split(' '), { maxBuffer: 1024 * 20000 }, function (error, stdout) {
if (!error) {

View File

@ -120,6 +120,29 @@ function system(callback) {
util.noop();
}
}
if ((_freebsd || _openbsd || _netbsd) && !result.virtualHost) {
try {
const procInfo = execSync('dmidecode -t 4');
const procLines = procInfo.toString().split('\n');
const procManufacturer = util.getValue(procLines, 'manufacturer', ':', true);
switch (procManufacturer.toLowerCase()) {
case 'virtualbox':
result.virtualHost = 'VirtualBox';
break;
case 'vmware':
result.virtualHost = 'VMware';
break;
case 'kvm':
result.virtualHost = 'KVM';
break;
case 'bochs':
result.virtualHost = 'bochs';
break;
}
} catch (e) {
util.noop();
}
}
// detect docker
if (fs.existsSync('/.dockerenv') || fs.existsSync('/.dockerinit')) {
result.model = 'Docker Container';