[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#5475: Archives with filenames with square brackets

From: Juri Linkov
Subject: bug#5475: Archives with filenames with square brackets
Date: Thu, 04 Feb 2010 01:54:59 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.92 (x86_64-pc-linux-gnu)

> Until this option is implemented we should ignore stderr.

Hmm, discarding stderr is too bad.  Better would be to redirect stderr
to a temporary file and display it when it contains error messages
(a pending patch):

=== modified file 'lisp/arc-mode.el'
--- lisp/arc-mode.el    2010-02-01 22:35:04 +0000
+++ lisp/arc-mode.el    2010-02-03 23:54:00 +0000
@@ -1076,11 +1099,11 @@ (defun archive-*-extract (archive name c
     (archive-delete-local tmpfile)
-(defun archive-extract-by-stdout (archive name command)
+(defun archive-extract-by-stdout (archive name command &optional stderr-file)
   (apply 'call-process
         (car command)
-        t
+        (if stderr-file (list t stderr-file) t)
         (append (cdr command) (list archive name))))
@@ -1999,7 +2022,65 @@ (defun archive-rar-exe-extract (archive 
       (if tmpbuf (kill-buffer tmpbuf))
       (delete-file tmpfile))))
+(defun archive-7z-extract (archive name)
+  (let ((tmpfile (make-temp-file "7z-stderr")))
+    ;; 7z doesn't provide a `quiet' option to suppress non-essential
+    ;; stderr messages.  So redirect stderr to a temp file and display it
+    ;; in the echo area when it contains error messages.
+    (prog1 (archive-extract-by-stdout
+           archive name archive-7z-extract tmpfile)
+      (with-temp-buffer
+       (insert-file-contents tmpfile)
+       (unless (search-forward "Everything is Ok" nil t)
+         (message (buffer-string)))
+       (delete-file tmpfile)))))

Juri Linkov

reply via email to

[Prev in Thread] Current Thread [Next in Thread]