On Fri, Sep 25, 2009 at 12:04 AM, Gary Oberbrunner <ga...@genarts.com> wrote: > emacsclientw exits with a random exit status when called from a win32 window > app (such as emacs itself). The reason is an uninitialized variable in > w32_teardown_window in w32emacsclient.h. I suspect if "ret" is initialized > to zero (exit status success) in this function it would just work. I don't > have mingw so I can't compile it here myself, sorry. > > This is on emacs 23.1.50, also happens on the latest CVS test version. I'm > using the EmacsW32 patched version on XP, but don't think that matters either.
It does in this case. Thanks for the fix below, I will apply it to EmacsW32. (The standard emacsclientw.exe does not have any windows.) > The symptom is easy to reproduce. In a shell window inside emacs (I use > cygwin zsh, but any shell will work), run > emacsclient foo || echo BAD > then C-x # to close the server buffer, and then look back in the shell window: > % emacsclientw foo || echo BAD > Waiting for Emacs... > BAD > % > > (I'm sure you already know that "emacsclient", the non-windows version, is > totally broken, gives "Unknown&_command:&"... but emacsclientw is fine so it > doesn't really matter.) > > Here's the affected code: > =========== > int > w32_teardown_window (int connected) > { > int ret; <<<<<<<<<<====== FIX HERE to int ret=0; > if (w32_window_app ()) > { > w32_check_not_synced(); > w32_wait_threads_fin(connected); > ret = W32_SYNC_get_g_exit_value(); > DeleteCriticalSection(&g_cs.cs); > return ret; > } > else > ret = g_exit_value; > return ret; > } > ============ > > > -- > . . . . . . . . . . . . . . . . . . . . . . . . . > Gary Oberbrunner ga...@genarts.com > GenArts, Inc. Tel: 617-492-2888 > 955 Mass. Ave Fax: 617-492-2852 > Cambridge, MA 02139 USA www.genarts.com > > >