/** * Parsing for the disk-usage commands smart_system_metrics shells out to. * * Split out so it can be tested without a Windows host. Every CI job runs * ubuntu-latest, so the `win32` branch had never been executed by a test -- the * same blind spot that let the wmic process-column defects survive a green * pipeline (see utils/wmic-csv.ts). */ export interface DiskUsage { path: string; total: number; used: number; free: number; usagePercent: number; } /** * Parse `wmic logicaldisk get size,freespace,caption`. * * Columns come back alphabetically -- Caption, FreeSpace, Size -- which for * this field set happens to equal the requested order, so the indices are * right. The defects were elsewhere: * * THE REQUESTED DRIVE WAS IGNORED. The row was chosen with * `lines.find(l => l.includes('C:'))`, so every path handed to the tool came * back with the system drive. On a machine with C: (23 GB free) and F: * (487 GB free), asking about F: reported C:. Callers pass a LIST of paths * precisely because they expect one answer per path. * * A DRIVE WITH NO MEDIA reports blank Size and FreeSpace -- an empty card * reader or optical drive. `parseInt('')` is NaN, which flowed into `used` * and a NaN usagePercent that nothing rejected. * * @param output Raw command output. * @param path The path whose drive is wanted; a path with no drive letter takes * the first drive listed, which preserves the behaviour of the `/` default. */ export declare function parseWindowsDiskOutput(output: string, path: string): DiskUsage | null; /** * Parse `df -k `. * * df wraps onto a second line when the device name is long, which is common for * mapped volumes and container overlays. Taking `lines[1]` blindly then read a * line holding only the device name, failed the field-count guard and returned * null -- reporting no disk at all rather than the disk. The numeric row is now * located by content instead of by position. */ export declare function parseUnixDiskOutput(output: string, path: string): DiskUsage | null; //# sourceMappingURL=disk-output.d.ts.map