Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
2.3k views
in Technique[技术] by (71.8m points)

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

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

after accepting the default program to run (either "bash.exe" or "zsh.exe", from Cygwin, and present in my Windows PATH environment variable).

M-x shell does work with Zsh/Bash from Cygwin. But I'd like to use Term to get more features...

Any help?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

From my experience none of the terminal emulators in Emacs (term, ansi-term, multi-term) is supported under Windows. It looks like the main reason is all of them rely on low-level support for terminals (stty, etc) which is not provided by Windows. Trying to force Emacs to use, say, Cygwin bash by editing references to e.g. /bin/sh in term.el doesn't help either. It may work in Cygwin Emacs but I haven't used it in a long time because native W32 Emacs is so much better (for me). Shell mode works fine with either Cygwin bash or Windows cmd (via cmdproxy which is part of Emacs install). You can have support for ANSI colors if you do

(add-hook 'shell-mode-hook 'ansi-color-for-comint-mode-on)

I tried eshell many times but ended up using the shell mode with bash because I tend to use pipes and redirections a lot. Are there any particular applications that you would like to use that require full-featured terminal support? I was missing top at first but then I just started using M-x proced.

UPDATE: term, ansi-term, and multi-term do work in Cygwin emacs.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...