* lisp/net/mailcap.el (mailcap-view-mime): Most MIME viewers can't
take input on stdin (and in any case, "-" is not how many of them
designate stdin) (bug#43318). So rewrite to put the data on a
file and feed the file name to the viewer.
`mailcap--computed-mime-data' determines the method to use."
(let ((method (mailcap-mime-info type)))
(if (stringp method)
- (shell-command-on-region (point-min) (point-max)
- ;; Use stdin as the "%s".
- (format method "-")
- (current-buffer)
- t)
+ (let ((file (make-temp-file "emacs-mailcap" nil
+ (cadr (split-string type "/")))))
+ (unwind-protect
+ (let ((coding-system-for-write 'binary))
+ (write-region (point-min) (point-max) file nil 'silent)
+ (shell-command (format method file)))
+ (when (file-exists-p file)
+ (delete-file file))))
(funcall method))))
(provide 'mailcap)