From 01c5625d4c9b47573b1b3c8fb9d5672ff87b6696 Mon Sep 17 00:00:00 2001 From: Max Nikulin Date: Thu, 2 Jun 2022 23:55:09 +0700 Subject: [PATCH] org.el: Use `call-process' to launch external viewers lisp/org.el (org-open-file): Another attempt to make launching of viewers more reliable by using approach from `browse-url' with hope to alleviate (bug#55672). Unfortunately any errors are silently ignored. --- lisp/org.el | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/lisp/org.el b/lisp/org.el index 95dff27ad..2cc122f5f 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -8015,16 +8015,19 @@ If the file does not exist, throw an error." (save-window-excursion (message "Running %s...done" cmd) - ;; Handlers such as "gio open" and kde-open5 start viewer in background - ;; and exit immediately. Use pipe connection type instead of pty to - ;; avoid killing children processes with SIGHUP when temporary terminal - ;; session is finished. - ;; - ;; TODO: Once minimum Emacs version is 25.1 or above, consider using - ;; the `make-process' invocation from 5db61eb0f929 to get more helpful - ;; error messages. - (let ((process-connection-type nil)) - (start-process-shell-command cmd nil cmd)) + ;; Handlers such as "gio open" and kde-open5 start viewer in + ;; background and exit immediately. As a result + ;; `start-shell-process' with default pty + ;; `process-connection-type', children processes are killed + ;; with SIGHUP when temporary terminal session is finished. + ;; Pipe processes have other set of problems, see (bug#55672), + ;; (bug#12972) message 47. Shoot and forget method borrowed + ;; from `browse-url-xdg-open' has an advantage that launched + ;; viewer may run after quitting from Emacs. It is hard to + ;; avoid shell here since it is required by mailcap + ;; specification, but with shell all errors are silently + ;; ignored. + (call-process shell-file-name nil 0 nil shell-command-switch cmd) (and (boundp 'org-wait) (numberp org-wait) (sit-for org-wait)))) ((or (stringp cmd) (eq cmd 'emacs)) -- 2.25.1