diff --git a/CHANGELOG.md b/CHANGELOG.md index f3ead13..f6c7b90 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -100,6 +100,7 @@ Other changes | Version | Date | Comment | | -------------- | -------------- | -------- | +| 3.52.6 | 2018-12-28 | `versions()` bug fix macOS | | 3.52.5 | 2018-12-28 | preparing automated tests, travis-ci integration, added dev-dependencies | | 3.52.4 | 2018-12-27 | `graphics().controllers` bugfix linux | | 3.52.3 | 2018-12-27 | `os().codepage` bugfix | diff --git a/lib/osinfo.js b/lib/osinfo.js index 14da889..6e5c695 100644 --- a/lib/osinfo.js +++ b/lib/osinfo.js @@ -367,7 +367,7 @@ function versions(callback) { functionProcessed(); }); if (_darwin) { - const filename = '/Library/Developer/CommandLineTools/'; + let filename = '/Library/Developer/CommandLineTools/'; fs.access(filename, fs.constants.F_OK, (err) => { if (!err) { exec('git --version', function (error, stdout) { @@ -378,6 +378,22 @@ function versions(callback) { } functionProcessed(); }); + } else { + let filename = '/usr/local/Cellar/git'; + fs.access(filename, fs.constants.F_OK, (err) => { + if (!err) { + exec('git --version', function (error, stdout) { + if (!error) { + let git = stdout.toString().split('\n')[0] || ''; + git = (git.toLowerCase().split('version')[1] || '').trim(); + result.git = (git.split(' ')[0] || '').trim(); + } + functionProcessed(); + }); + } else { + functionProcessed(); + } + }); } }); } else {