admin/fs: disk-spaces on posix systems will show mounting point instead of device name
Massimo Melina committed
Mar 31, 2024 at 12:03 UTC
476b65d8d8c5836c4a94e03ef8e8ae7a3061fd1b
1 file changed
+2
-2
src/util-os.ts
+2
-2
@@ -36,7 +36,7 @@ export async function getDiskSpaces(): Promise<{ name: string, free: number, tot
36
description: x.Description
37
}))
38
}
39
- const { stdout } = await promisify(exec)(`df -k`).catch(err => {
39
+ const { stdout } = await promisify(exec)(`df -k -l`).catch(err => {
40
throw err.status === 1 ? Error('miss')
41
: err.status === 127 ? Error('unsupported')
42
: err
@@ -46,7 +46,7 @@ export async function getDiskSpaces(): Promise<{ name: string, free: number, tot
46
throw Error('unsupported')
47
return onlyTruthy(out.map(one => {
48
const bits = one.split(/\s+/)
49
- const name = bits.shift() || ''
49
+ const name = bits.pop() || bits.shift() || ''
50
const [, used=0, free=0] = bits.map(x => Number(x) * 1024)
51
const total = used + free
52
return total && { free, total, name }