From 8c6e37cc61f6b5efa833312887461e2de1bb7651 Mon Sep 17 00:00:00 2001 From: Juergen Hoetzel Date: Sat, 14 May 2022 15:17:40 +0200 Subject: [PATCH] GNU and Darwin df shows space in 1K blocks by default Als use the "-k" parameter to enforce this block size, so that the command does not depend on environment variables (POSIXLY_CORRECT and BLOCKSIZE). Fixes #21 --- eshell-info-banner.el | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/eshell-info-banner.el b/eshell-info-banner.el index 0a4a378..eb73060 100644 --- a/eshell-info-banner.el +++ b/eshell-info-banner.el @@ -365,15 +365,15 @@ Common function between otherwise differ solely on the position of the mount point in the partition list. Its position is given by the argument MOUNT-POSITION." - (let ((partitions (cdr (split-string (eshell-info-banner--shell-command-to-string "df -l") + (let ((partitions (cdr (split-string (eshell-info-banner--shell-command-to-string "df -l -k") (regexp-quote "\n") t)))) (cl-remove-if #'null (mapcar (lambda (partition) (let* ((partition (split-string partition " " t)) (filesystem (nth 0 partition)) - (size (string-to-number (nth 1 partition))) - (used (string-to-number (nth 2 partition))) + (size (* (string-to-number (nth 1 partition)) 1024)) + (used (* (string-to-number (nth 2 partition)) 1024)) (percent (nth 4 partition)) (mount (nth mount-position partition))) (when (seq-some (lambda (prefix)