bug fix fsSize on OSX

This commit is contained in:
Sebastian Hildebrandt 2016-11-14 12:29:11 +01:00
parent 5e2ad9ceb8
commit eed8fd8e47
3 changed files with 8 additions and 5 deletions

View File

@ -89,6 +89,7 @@ Other changes
| Version | Date | Comment | | Version | Date | Comment |
| -------------- | -------------- | -------- | | -------------- | -------------- | -------- |
| 3.10.2 | 2016-11-14 | bug fix fsSize on OSX |
| 3.10.1 | 2016-11-14 | optimization fsStats, disksIO, networkStats | | 3.10.1 | 2016-11-14 | optimization fsStats, disksIO, networkStats |
| 3.10.0 | 2016-11-12 | added blockDevices, fixed fsSize, added file system type | | 3.10.0 | 2016-11-12 | added blockDevices, fixed fsSize, added file system type |
| 3.9.0 | 2016-11-11 | added MAC address to networkInterfaces, fixed currentLoad | | 3.9.0 | 2016-11-11 | added MAC address to networkInterfaces, fixed currentLoad |

View File

@ -40,7 +40,8 @@ function fsSize(callback) {
reject(error); reject(error);
} }
exec("df -lkPT | grep ^/", function (error, stdout) { let cmd = (_darwin ? "df -lkP | grep ^/" : "df -lkPT | grep ^/");
exec(cmd, function (error, stdout) {
let data = []; let data = [];
if (!error) { if (!error) {
let lines = stdout.toString().split('\n'); let lines = stdout.toString().split('\n');
@ -50,10 +51,10 @@ function fsSize(callback) {
line = line.replace(/ +/g, " ").split(' '); line = line.replace(/ +/g, " ").split(' ');
data.push({ data.push({
'fs': line[0], 'fs': line[0],
'type': line[1], 'type': (_linux ? line[1] : 'HFS'),
'size': parseInt(line[2]) * 1024, 'size': parseInt((_linux ? line[2] : line[1])) * 1024,
'used': parseInt(line[3]) * 1024, 'used': parseInt((_linux ? line[3] : line[2])) * 1024,
'use': parseFloat((100.0 * line[3] / line[2]).toFixed(2)), 'use': parseFloat((100.0 * (_linux ? line[3] : line[2]) / (_linux ? line[2] : line[1])).toFixed(2)),
'mount': line[line.length - 1] 'mount': line[line.length - 1]
}) })
} }

View File

@ -81,6 +81,7 @@
// -------------------------------- // --------------------------------
// //
// version date comment // version date comment
// 3.10.2 2016-11-14 bug fix fsSize on OSX
// 3.10.1 2016-11-14 optimization fsStats, disksIO, networkStats // 3.10.1 2016-11-14 optimization fsStats, disksIO, networkStats
// 3.10.0 2016-11-12 added blockDevices, fixed fsSize, added file system type // 3.10.0 2016-11-12 added blockDevices, fixed fsSize, added file system type
// 3.9.0 2016-11-11 added MAC address to networkInterfaces, fixed currentLoad // 3.9.0 2016-11-11 added MAC address to networkInterfaces, fixed currentLoad