fix: wrong code for unused feature
Massimo Melina committed
Oct 27, 2025 at 23:37 UTC
a0a4bbc1999f7452f2b10796fa54643036ece001
1 file changed
+2
-3
src/util-os.ts
+2
-3
@@ -1,12 +1,11 @@
1
import { dirname } from 'path'
2
import { existsSync, statfsSync } from 'fs'
3
import { exec, execFile, ExecOptions } from 'child_process'
4
-import { isWindowsDrive, onlyTruthy, promiseBestEffort } from './misc'
4
+import { exists, isWindowsDrive, onlyTruthy, promiseBestEffort } from './misc'
5
import Parser from '@gregoranders/csv';
6
import { pid, ppid } from 'node:process'
7
import { promisify } from 'util'
8
import { IS_WINDOWS } from './const'
9
-import { access } from 'fs/promises'
9
import { statfs } from 'node:fs/promises'
10
11
const DF_TIMEOUT = 2000
@@ -27,7 +26,7 @@ export function cmdEscape(par: string) {
26
}
27
28
export async function getDiskSpace(path: string) {
30
- while (path && !isWindowsDrive(path) && !access(path))
29
+ while (path && !isWindowsDrive(path) && !await exists(path))
30
path = dirname(path)
31
const res = await statfs(path)
32
return { free: res.bavail * res.bsize, total: res.blocks * res.bsize, name: path }