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
I tried to run M-x term
from 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.