1

Windows, Emacs 27.2.

I execute fairly simple cygwin commands from an Emacs shell - first tried unzip then backed up to test ls - and the shell exits. Why?

6
  • Downloaded and ran the latest windows version, 29.1_2, and it still has the same problem. Something as simple as a cygwin ls in an Emacs shell and the command executes, then the shell exits. Commented Sep 30, 2023 at 22:55
  • You may need to provide more info, to specify just what you did. Commented Oct 1, 2023 at 1:34
  • I got a new laptop, so instead of using the Emacs 26.x (can't remember exactly, but had no problem using any command from cygwin), I installed the latest 29.4, and Cygwin. Then exactly this type of behavior happens. Whenever a command executed, the shell is terminated with a message "Process shell finished." I spent a great amount of time using ChatGTP and CoPilot, and tried every possible suggestions they suggested (probably learned from old posts for earlier versions), and none of them worked. So now I do believe this is a bug in emacs, because I used PowerShell and it has no problem at all. Commented Aug 23, 2024 at 1:42
  • So a year later, no resolution? It has been a long time ago, if anyone can reproduce with a new installation and report back the behavior, I will enter a bug. Commented Sep 10, 2024 at 1:59
  • i've the same issue on 31.0.50 Master NC. ALL unix based commands i run in a shell(cmd) under Windows10 exits with "Process shell finished". I tried Msys2 and Cygwin. In a Eshell it works fine. I also used google CoPilot and Chatgpt no success. I hope someone gcould give a answer a hint whatever... Commented Nov 1, 2024 at 13:50

2 Answers 2

0

I think I figured it out. The default shell-file-name is changed for my newly installed emacs 29.4, I have to explicitly asking emacs to use the bash.exe by (setq shell-file-name "C:/cygwin64/bin/bash.exe") Otherwise, it shows a different program used for shell-file-name:

Its value is "C:/Emacs/emacs-29.4/libexec/emacs/29.4/x86_64-w64-mingw32/cmdproxy.exe" Original value was "G:/rel/emacs-29.4/nt/cmdproxy.exe" 

And my shell gets terminated every time I issues a unix command if I use this cmdproxy.exe.

Now I need to fix a complaint in emacs for my set prompt PS1 in .bashrc:

bash: cannot set terminal process group (-1): Inappropriate ioctl for device bash: no job control in this shell 

But this is just a nuisance, I can also ignore it and my shell stays! :)

0

I have this issue on

GNU Emacs 30.1 (build 2, x86_64-w64-mingw32) of 2025-02-23

Having dug a little bit further into the long history of this problem, I find that there are two causes listed, both of which look a lot like a problem in search of a maintainer

  1. Running MSYS programs in M-x shell on a native build of Emacs should be considered "not really supported". see https://lists.gnu.org/archive/html/bug-gnu-emacs/2024-03/msg00781.html

  2. emacs comint sends an EOF character into the pipe to flush the buffer, which then gets misinterpreted by CMD.exe causing it to exit because it is runing on a pipe, not a PTY. see https://lists.gnu.org/archive/html/emacs-devel/2023-01/msg00242.html

I would lean towards the second problem above, as cmdproxy.exe works just fine when I run it standalone. That said, the non-fix suggested in the email thread doesn't work for me either.

https://lists.gnu.org/archive/html/bug-gnu-emacs/2024-03/msg00864.html

Sorry for no help here, but the first point above is probably the actual answer.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.