versions() - bugfix git version macOS
This commit is contained in:
parent
a5343b3db0
commit
161387cf02
@ -100,6 +100,7 @@ Other changes
|
||||
|
||||
| Version | Date | Comment |
|
||||
| -------------- | -------------- | -------- |
|
||||
| 3.42.1 | 2018-07-03 | `versions()` bugfix git version macOS |
|
||||
| 3.42.0 | 2018-06-01 | `processes()` added parent process PID |
|
||||
| 3.41.4 | 2018-05-28 | windows exec WMIC in try catch |
|
||||
| 3.41.3 | 2018-05-13 | improved SunOS support `getStaticData()`, `getDynamicData()` |
|
||||
|
||||
@ -54,13 +54,13 @@ async function cpu() {
|
||||
|
||||
(last 7 major and minor version releases)
|
||||
|
||||
- Version 3.42.0: added parent process PID `processes()`
|
||||
- Version 3.41.0: first partial `SunOS` support
|
||||
- Version 3.40.0: extended `versions()` (php, redis, mongodb)
|
||||
- Version 3.39.0: added `versions().mysql` and `versions().nginx`, start implementing `SunOS` support
|
||||
- Version 3.38.0: added `battery.acconnected`
|
||||
- Version 3.37.0: extended FreeBSD support `networkStats()`
|
||||
- Version 3.36.0: extended FreeBSD support `networkConnections()`
|
||||
- Version 3.35.0: extended FreeBSD support `processLoad()`
|
||||
- ...
|
||||
|
||||
You can find all changes here: [detailed changelog][changelog-url]
|
||||
|
||||
@ -15,6 +15,7 @@
|
||||
const os = require('os');
|
||||
const exec = require('child_process').exec;
|
||||
const util = require('./util');
|
||||
const fs = require('fs');
|
||||
|
||||
let _platform = process.platform;
|
||||
|
||||
@ -251,10 +252,10 @@ function osInfo(callback) {
|
||||
callback(result);
|
||||
}
|
||||
resolve(result);
|
||||
});
|
||||
});
|
||||
} catch (e) {
|
||||
if (callback) { callback(result); }
|
||||
resolve(result);
|
||||
resolve(result);
|
||||
}
|
||||
}
|
||||
});
|
||||
@ -286,7 +287,7 @@ function versions(callback) {
|
||||
};
|
||||
|
||||
let functionProcessed = (function () {
|
||||
let totalFunctions = 12;
|
||||
let totalFunctions = 13;
|
||||
return function () {
|
||||
if (--totalFunctions === 0) {
|
||||
if (callback) {
|
||||
@ -337,6 +338,30 @@ function versions(callback) {
|
||||
}
|
||||
functionProcessed();
|
||||
});
|
||||
if (_darwin) {
|
||||
const filename = '/Library/Developer/CommandLineTools/';
|
||||
fs.access(filename, fs.constants.F_OK, (err) => {
|
||||
if (!err) {
|
||||
exec('git --version', function (error, stdout) {
|
||||
if (!error) {
|
||||
result.git = stdout.toString().split('\n')[0] || '';
|
||||
result.git = (result.git.toLowerCase().split('version')[1] || '').trim();
|
||||
result.git = (result.git.split(' ')[0] || '').trim();
|
||||
}
|
||||
functionProcessed();
|
||||
});
|
||||
}
|
||||
});
|
||||
} else {
|
||||
exec('git --version', function (error, stdout) {
|
||||
if (!error) {
|
||||
result.git = stdout.toString().split('\n')[0] || '';
|
||||
result.git = (result.git.toLowerCase().split('version')[1] || '').trim();
|
||||
result.git = (result.git.split(' ')[0] || '').trim();
|
||||
}
|
||||
functionProcessed();
|
||||
});
|
||||
}
|
||||
exec('git --version', function (error, stdout) {
|
||||
if (!error) {
|
||||
result.git = stdout.toString().split('\n')[0] || '';
|
||||
@ -386,10 +411,10 @@ function versions(callback) {
|
||||
result.mongodb = (result.mongodb.toLowerCase().split(',')[0] || '').replace(/[^0-9.]/g, '');
|
||||
}
|
||||
functionProcessed();
|
||||
});
|
||||
});
|
||||
} catch (e) {
|
||||
if (callback) { callback(result); }
|
||||
resolve(result);
|
||||
resolve(result);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user