`M-x term' with Emacs on MS Windows: error Spawning child process: invalid argument

前端 未结 4 1136
北荒
北荒 2020-12-18 23:41

whenever I try to launch M-x term from my Windows distribution of GNU Emacs, I get the error:

apply: Spawning child process: invalid argument
4条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-19 00:00

    I tried to run M-x termfrom a MingW64 emacs with an MSYS2 bash.exe and I got the same error as you got. It is possible to get a little bit further by changing term-exec-1 in term.el to read:

        (apply 'start-process name buffer
               (getenv "SHELL") "-c"
           (format "stty -nl echo rows %d columns %d sane 2>/dev/null;\
    if [ $1 = .. ]; then shift; fi; exec \"$@\""
               term-height term-width)
           ".."
           command "-i" switches)))
    

    You need to answer with the MSYS2 shell path which is something like /usr/bin/bash.exe and then you get a terminal. The problem is that the terminal is messed up. The stty command doesn't work on it and the cr doesn't work. Also, the cd emacs function receives MSYS2 paths like /c/usr/share/emacs/ which are not valid. This function needs to be advised to transform those paths to Windows paths.

提交回复
热议问题