fsSize() parsing improvement linux and alpine

This commit is contained in:
Sebastian Hildebrandt 2023-06-07 08:42:20 +02:00
parent 4a499ebb8f
commit 58b64788a7

View File

@ -137,7 +137,7 @@ function fsSize(drive, callback) {
}
}
if (_linux) {
cmd = 'df -lkPTx squashfs';
cmd = 'export LC_ALL=C; df -lkPTx squashfs; unset LC_ALL';
execSync('cat /proc/mounts 2>/dev/null').toString().split('\n').filter(line => {
return line.startsWith('/');
}).forEach((line) => {
@ -158,7 +158,7 @@ function fsSize(drive, callback) {
return item.fs.toLowerCase().indexOf(drive.toLowerCase()) >= 0 || item.mount.toLowerCase().indexOf(drive.toLowerCase()) >= 0;
});
}
if (!error || data.length) {
if ((!error || data.length) && stdout.toString().toLowerCase().indexOf('unrecognized option') === -1) {
if (callback) {
callback(data);
}