From 58b64788a77486e66884e97632ea48b3f45450df Mon Sep 17 00:00:00 2001 From: Sebastian Hildebrandt Date: Wed, 7 Jun 2023 08:42:20 +0200 Subject: [PATCH] fsSize() parsing improvement linux and alpine --- lib/filesystem.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/filesystem.js b/lib/filesystem.js index 3717b90..b84baf9 100644 --- a/lib/filesystem.js +++ b/lib/filesystem.js @@ -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); }