Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Terminal in Emacs in Windows - Error message: "Spawning child process; invalid argument"

I'm trying to start a cmd terminal in Emacs 23.2 (latest version) in Windows.

According to the Manual, I can enter in terminal mode (starting a new buffer for the terminal) in Emacs by typing M-x term.

When I do this, I get prompted for:

Run program: path_to-emacs/bin/cmdproxy.exe

When I type RET, I get the following error message in the minibuffer:

Spaning child process: invalid argument

Any ideas how to make it work?

like image 448
Amelio Vazquez-Reina Avatar asked Dec 26 '10 21:12

Amelio Vazquez-Reina


3 Answers

The following should do:

  • M-:(make-comint-in-buffer "cmd" nil "cmd" nil)

  • M-xeshell

  • M-xshell

All have both their pros and cons. So choose what suits you best.

like image 144
Bleeding Fingers Avatar answered Nov 08 '22 12:11

Bleeding Fingers


Had the same problem.

I ran procmon and discovered that Emacs wants to find c:\bin\sh in some form (sh.exe, sh.bat, sh.cmd, etc).
Since I happened to want to use term mode with the android debugging shell, I created c:\bin\sh.bat with contents "adb shell", and it worked fine, albeit with some weird input lag.

like image 3
Dave Avatar answered Nov 08 '22 13:11

Dave


I got the same error while trying to run M-x compile. I added the following to my .emacs file and it fixed the problem:

;; Make sure that the bash executable can be found
(setq explicit-shell-file-name "C:/cygwin/bin/bash.exe")
(setq shell-file-name explicit-shell-file-name)
(add-to-list 'exec-path "C:/cygwin/bin")

Obviously this solution will only work if you have Cygwin installed, but if you are running Emacs on Windows it is usually worth at least a minimal install of Cygwin because many Emacs commands can leverage the command-line tools made available by cygwin (M-x compile in my case).

like image 5
nispio Avatar answered Nov 08 '22 14:11

nispio