aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
authorLars Ingebrigtsen2019-10-30 01:02:43 +0100
committerLars Ingebrigtsen2019-10-30 01:02:48 +0100
commit7ce00e9a8bf9dc3793348d2c6f4762e90f45c11b (patch)
tree934e1875d897933450ce50eb6816bee0aa51ad32 /lisp
parentba7755bfb78884fd57e2506bcaebb51b5ff1ba1b (diff)
downloademacs-7ce00e9a8bf9dc3793348d2c6f4762e90f45c11b.tar.gz
emacs-7ce00e9a8bf9dc3793348d2c6f4762e90f45c11b.zip
Fix image-converter probes
* lisp/image/image-converter.el (image-converter--probe): Check that the executable exists before trying to call it.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/image/image-converter.el19
1 files changed, 11 insertions, 8 deletions
diff --git a/lisp/image/image-converter.el b/lisp/image/image-converter.el
index f046529fd57..2e09976c011 100644
--- a/lisp/image/image-converter.el
+++ b/lisp/image/image-converter.el
@@ -100,9 +100,10 @@ where created with DATA-P nil (i.e., it has to refer to a file)."
100 (with-temp-buffer 100 (with-temp-buffer
101 (let ((command (image-converter--value type :command)) 101 (let ((command (image-converter--value type :command))
102 formats) 102 formats)
103 (when (zerop (apply #'call-process (car command) nil '(t nil) nil 103 (when (and (executable-find (car command))
104 (append (cdr command) 104 (zerop (apply #'call-process (car command) nil '(t nil) nil
105 (image-converter--value type :probe)))) 105 (append (cdr command)
106 (image-converter--value type :probe)))))
106 (goto-char (point-min)) 107 (goto-char (point-min))
107 (when (re-search-forward "^-" nil t) 108 (when (re-search-forward "^-" nil t)
108 (forward-line 1) 109 (forward-line 1)
@@ -119,8 +120,9 @@ where created with DATA-P nil (i.e., it has to refer to a file)."
119 formats) 120 formats)
120 ;; Can't check return value; ImageMagick convert usually returns 121 ;; Can't check return value; ImageMagick convert usually returns
121 ;; a non-zero result on "-list format". 122 ;; a non-zero result on "-list format".
122 (apply #'call-process (car command) nil '(t nil) nil 123 (when (executable-find (car command))
123 (append (cdr command) (image-converter--value type :probe))) 124 (apply #'call-process (car command) nil '(t nil) nil
125 (append (cdr command) (image-converter--value type :probe))))
124 (goto-char (point-min)) 126 (goto-char (point-min))
125 (when (re-search-forward "^-" nil t) 127 (when (re-search-forward "^-" nil t)
126 (forward-line 1) 128 (forward-line 1)
@@ -135,9 +137,10 @@ where created with DATA-P nil (i.e., it has to refer to a file)."
135 (with-temp-buffer 137 (with-temp-buffer
136 (let ((command (image-converter--value type :command)) 138 (let ((command (image-converter--value type :command))
137 formats) 139 formats)
138 (when (zerop (apply #'call-process (car command) nil '(t nil) nil 140 (when (and (executable-find (car command))
139 (append (cdr command) 141 (zerop (apply #'call-process (car command) nil '(t nil) nil
140 (image-converter--value type :probe)))) 142 (append (cdr command)
143 (image-converter--value type :probe)))))
141 (goto-char (point-min)) 144 (goto-char (point-min))
142 (when (re-search-forward "^ *-" nil t) 145 (when (re-search-forward "^ *-" nil t)
143 (forward-line 1) 146 (forward-line 1)