On 02/07/2021 01:38, Eli Zaretskii wrote:
From: Maxim Nikulin Date: Fri, 2 Jul 2021 00:01:59 +0700
--- a/lisp/net/mailcap.el
+++ b/lisp/net/mailcap.el
- (start-process-shell-command command nil command)))
...
+ (make-process
+ :name "mailcap-view-file" :connection-type 'pipe :noquery t
+ :buffer nil ; "*Messages*" may be suitable for debugging
+ :sentinel (lambda (proc event)
+ (when (and (memq (process-status proc) '(exit signal))
+ (/= (process-exit-status proc) 0))
+ (message
+ "Command %s: %s."
+ (mapconcat #'identity (process-command proc) " ")
+ (substring event 0 -1))))
+ :command (list shell-file-name shell-command-switch command))))
First, you replace start-process-shell-command with make-process, and
I'm not sure I understand why. If all you want is to use pipes, why
not simply bind process-connection-type around the call to
start-process-shell-command?
+ ;; An alternative is `process-connection-type' let-bound to nil for
+ ;; `start-process-shell-command' call (with no chance to report failure).
-----------------------------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
If main process of the handler fails then show a message with exit
reason.
---^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
And with other handlers, this could be an
incompatible behavior change if the handler behaves differently when
its standard handles are connected to a pipe rather than a terminal
device.
Example of such handler, please.