Subject: bug#69795: 29.1; cmdproxy.exe exits automatically after executing MSYS2 commands

From: Eli Zaretskii <[email-masked]>
Date: Thu, 14 Mar 2024 18:48:53 +0200

> From: [email-masked]
> Cc: [email-masked]
> Date: Fri, 15 Mar 2024 00:56:02 +0900
> 
> Replacing 'ls -ld .' with 'ls -d .', which outputs only '.',
> cmdproxy.exe exits, too.
> Replacing 'ls -d .' with 'ls -d . < nul' does not make cmdproxy.exe exit.

If cmdproxy exits, it probably means cmd.exe that cmdproxy runs
exited.  The shell-mode buffer interacts with cmd.exe, not with
cmdproxy.  cmdproxy in this scenario is used only to start an inferior
cmd.exe.

You may wish looking in the Windows Event Log, under Application.  It
is possible that there's some useful information there about why you
see that shell process finishes, like which program crashed and why.

Or maybe this could be the return of this old problem:

  https://lists.gnu.org/archive/html/emacs-devel/2023-01/msg00242.html

> > If you want to run MSYS or Cygwin programs from Emacs, my suggestion
> > is to use the Cygwin build of Emacs.  There are two configurations for
> > that: either use the Cygwin X server, or use the w32 "toolkit"; the
> > latter possibility has the look-and-feel very similar to the native
> > Windows build, so maybe you will prefer it.
> >
> > Other than that, running MSYS programs from a native build of Emacs
> > should be considered "not really supported".
> 
> Is calling MSYS2 commands from #'start-process or #'call-process
> not recommended?

In general, not recommended, due to the compatibility issues I
described.  (But cmdproxy is not involved when start-process or
call-process are used, unless the application is a DOS program.)

> I only needed gdb, another binary will do. But I do not know where to
> get a reliable gdb binary run with emacs shell-mode.

Doesn't MSYS2 provide a MinGW64 build of GDB, not just an MSYS build?
GDB builds natively with MinGW tools, so there should be no problem
for MSYS2 folks to provide a native 64-bit Windows build of GDB.