GNU bug report logs - #36270
executable-find does not find shell commands on MSYS2

Previous Next

Package: emacs;

Reported by: Juanma Barranquero <lekktu <at> gmail.com>

Date: Mon, 17 Jun 2019 23:44:01 UTC

Severity: wishlist

Merged with 7784

Full log


Message #27 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Andy Moreton <andrewjmoreton <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: Re: bug#36270: executable-find does not find shell commands on MSYS2
Date: Wed, 19 Jun 2019 18:38:02 +0100
On Wed 19 Jun 2019, Eli Zaretskii wrote:
>> From: Juanma Barranquero <lekktu <at> gmail.com>
>> I stumbled upon this because I was trying to understand failures in
>> vc-tests.el on Windows, and the reason is that it calls call-process
>> to run some shell scripts, like ci. I'd like to fix that and run the
>> tests, but I haven't really stared at it long enough to know if
>> there's any non-ugly fix.
>
> One non-ugly fix is to use RCS from the ezwinports site.  The binaries
> there are 32-bit, but I don't think it will make any difference.

I use the following advice in a Windows build of emacs to get shell
scripts working for Cygwin. MSYS2 should be similar, with a suitable
setting for `shell-file-name':

  (defun call-process:filter-args (args)
    "Ensure native Windows emacs can run shell script programs."
    (let ((program (nth 0 args)))
      (if (executable-find program)
          args
        (list shell-file-name (nth 1 args) (nth 2 args) (nth 3 args)
              shell-command-switch
              (mapconcat #'shell-quote-argument
                         (append (list program) (nthcdr 4 args)) " ")))))
  (advice-add 'call-process :filter-args #'call-process:filter-args)

  (defun make-process:filter-args (args)
    "Ensure native Windows emacs can run shell script programs."
    (let* ((command (plist-get args :command)))
      (if (executable-find (car command))
          args
        (plist-put args :command
                   (list shell-file-name shell-command-switch
                         (mapconcat #'shell-quote-argument command " "))))))
  (advice-add 'make-process :filter-args #'make-process:filter-args))


Perhaps something similar could be added for Windows builds.

    AndyM





This bug report was last modified 5 years and 361 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.