bugfix diskLayout().size
This commit is contained in:
+4
-3
@@ -583,13 +583,14 @@ function diskLayout(callback) {
|
||||
} catch (e) {
|
||||
}
|
||||
|
||||
const size = util.getValue(lines, 'size', ':', true).trim();
|
||||
if (size && lines.length > 0 && lines[0].trim() === 'disk') {
|
||||
const sizeString = util.getValue(lines, 'size', ':', true).trim();
|
||||
const sizeValue = sizeString.match(/\(([^)]+)\)/)[1];
|
||||
if (sizeString && lines.length > 0 && lines[0].trim() === 'disk') {
|
||||
result.push({
|
||||
type: (mediumType === '0' ? 'SSD' : (mediumType === '1' ? 'HD' : (device.indexOf('SSD') > -1 ? 'SSD' : 'HD'))), // to be tested ... /sys/block/sda/queue/rotational
|
||||
name: util.getValue(lines, 'product:', ':', true),
|
||||
vendor: util.getValue(lines, 'vendor:', ':', true),
|
||||
size: parseInt(size.match(/\(([^)]+)\)/)[1]) * 1000 * 1000 * 1000 * 1000,
|
||||
size: parseInt(sizeValue, 10) * 1000 * 1000 * 1000 * (sizeValue.indexOf('T') >= 0 ? 1000 : 1),
|
||||
bytesPerSector: -1,
|
||||
totalCylinders: -1,
|
||||
totalHeads: -1,
|
||||
|
||||
Reference in New Issue
Block a user