pcstat
pcstat copied to clipboard
json output failed for empty file
It will be great if the empty file case can be handled when outputting json.
steps to reproduce this issue
❯ touch /tmp/test.txt # create an empty file
❯ pcstat /tmp/test.txt
+---------------+----------------+------------+-----------+---------+
| Name | Size (bytes) | Pages | Cached | Percent |
|---------------+----------------+------------+-----------+---------|
| /tmp/test.txt | 0 | 0 | 0 | NaN |
+---------------+----------------+------------+-----------+---------+
❯ pcstat -json /tmp/test.txt
2025/04/21 13:50:33 JSON formatting failed: json: unsupported value: NaN