Subject: bug#58877: 29.0.50; [PATCH] When killing Emacs from a client frame with no other frames, Emacs shows a useless error prompt

From: Eli Zaretskii <[email-masked]>
Date: Fri, 25 Nov 2022 22:18:56 +0200

> Date: Fri, 25 Nov 2022 11:31:07 -0800
> Cc: [email-masked]
> From: Jim Porter <[email-masked]>
> 
> Hm, it looks like the emacsclient may not be starting up correctly. 
> Could you try the attached patch? I doubt this will fix the tests, but 
> hopefully you'll get some more-useful error messages.

Here are the failure info from each failed test after this patch:

Test server-tests/emacsclient/create-frame condition:
    Output:
    (ert-test-failed "timed out waiting for (or (= (length server-clients) (1+ starting-client-count)) (eq (process-status emacsclient) exit-status)) to be non-nil")
   FAILED  1/7  server-tests/emacsclient/create-frame (5.062500 sec) at lisp/server-tests.el:138

Test server-tests/emacsclient/eval condition:
    Output:
    (wrong-type-argument number-or-marker-p nil)
   FAILED  2/7  server-tests/emacsclient/eval (0.109375 sec) at lisp/server-tests.el:150

Test server-tests/emacsclient/server-edit condition:
    Output:
    (ert-test-failed "timed out waiting for (get-buffer \"file.txt\") to be non-nil")
   FAILED  3/7  server-tests/emacsclient/server-edit (5.156250 sec) at lisp/server-tests.el:129

Test server-tests/server-force-stop/keeps-frames condition:
    Output:
    (ert-test-failed
     ((should
       (eq
        (process-status emacsclient)
        'run))
      :form
      (eq exit run)
      :value nil))
   FAILED  4/7  server-tests/server-force-stop/keeps-frames (0.109375 sec) at lisp/server-tests.el:159

Test server-tests/server-start/stop-prompt-with-client condition:
    Output:
    (ert-test-failed
     ((should
       (length=
        (frame-list)
        2))
      :form
      (length=
       (#<frame F1 06d263c0>)
       2)
      :value nil))
   FAILED  7/7  server-tests/server-start/stop-prompt-with-client (0.125000 sec) at lisp/server-tests.el:106