changeset 28399:85a5bab7541d

(dired-insert-directory): If dired-free-space-program failed just delete its output.
author Andreas Schwab <schwab@suse.de>
date Wed, 29 Mar 2000 20:02:10 +0000
parents 844fb933c1aa
children 206604013d7f
files lisp/dired.el
diffstat 1 files changed, 15 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/dired.el	Wed Mar 29 19:40:14 2000 +0000
+++ b/lisp/dired.el	Wed Mar 29 20:02:10 2000 +0000
@@ -681,18 +681,21 @@
 	  (when (re-search-forward "total [0-9]+$" nil t)
 	    (insert "  free ")
 	    (let ((beg (point)))
-	      (call-process dired-free-space-program nil t nil
-			    dired-free-space-args
-			    (expand-file-name dir-or-list))
-	      (goto-char beg)
-	      (forward-line 1)
-	      (skip-chars-forward "^ \t")
-	      (forward-word 2)
-	      (skip-chars-forward " \t")
-	      (delete-region beg (point))
-	      (forward-word 1)
-	      (delete-region (point)
-			     (progn (forward-line 1) (point))))))))
+	      (if (zerop (call-process dired-free-space-program nil t nil
+				       dired-free-space-args
+				       (expand-file-name dir-or-list)))
+		  (progn
+		    (goto-char beg)
+		    (forward-line 1)
+		    (skip-chars-forward "^ \t")
+		    (forward-word 2)
+		    (skip-chars-forward " \t")
+		    (delete-region beg (point))
+		    (forward-word 1)
+		    (delete-region (point)
+				   (progn (forward-line 1) (point))))
+		;; The dired-free-space-program failed; delete its output
+		(delete-region (- beg 7) (point))))))))
     ;; Quote certain characters, unless ls quoted them for us.
     (if (not (string-match "b" dired-actual-switches))
 	(save-excursion