diff options
| author | Jim Porter | 2022-11-21 11:47:08 -0800 |
|---|---|---|
| committer | Jim Porter | 2022-11-24 17:33:53 -0800 |
| commit | 28c444f72a9843ce335032db1fa0f484dfeb4833 (patch) | |
| tree | 65a8f51f8b1026dbd321d00512acc494e65016a7 /test | |
| parent | 339893f2e3b5cb7263ba5204e083d5605df72446 (diff) | |
| download | emacs-28c444f72a9843ce335032db1fa0f484dfeb4833.tar.gz emacs-28c444f72a9843ce335032db1fa0f484dfeb4833.zip | |
Don't explicitly delete client frames when killing Emacs anyway
This eliminates a useless error prompt when killing Emacs from a
client frame when there are no other frames (bug#58877).
* lisp/server.el (server-running-external): New error.
(server--file-name): New function...
(server-eval-at): ... use it.
(server-start): Factor out server stopping code into...
(server-stop): ... here.
(server-force-stop): Use 'server-stop', and tell it not to delete
frames.
* test/lisp/server-tests.el
(server-tests/server-force-stop/keeps-frames): New test.
Diffstat (limited to 'test')
| -rw-r--r-- | test/lisp/server-tests.el | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/test/lisp/server-tests.el b/test/lisp/server-tests.el index 48ef110943e..370cf86148a 100644 --- a/test/lisp/server-tests.el +++ b/test/lisp/server-tests.el | |||
| @@ -131,4 +131,39 @@ | |||
| 131 | "--eval" (format "(setq server-tests/variable %d)" value)) | 131 | "--eval" (format "(setq server-tests/variable %d)" value)) |
| 132 | (server-tests/wait-until (eq server-tests/variable value))))) | 132 | (server-tests/wait-until (eq server-tests/variable value))))) |
| 133 | 133 | ||
| 134 | (ert-deftest server-tests/server-force-stop/keeps-frames () | ||
| 135 | "Ensure that `server-force-stop' doesn't delete frames. See bug#58877. | ||
| 136 | Note: since that bug is about a behavior when killing Emacs, this | ||
| 137 | test is somewhat indirect. (Killing the current Emacs instance | ||
| 138 | would make it hard to check test results!) Instead, it only | ||
| 139 | tests that `server-force-stop' doesn't delete frames (and even | ||
| 140 | then, requires a few tricks to run as a regression test). So | ||
| 141 | long as this works, the problem in bug#58877 shouldn't occur." | ||
| 142 | (let (terminal) | ||
| 143 | (unwind-protect | ||
| 144 | (server-tests/with-server | ||
| 145 | (let ((emacsclient (server-tests/start-emacsclient "-c"))) | ||
| 146 | (server-tests/wait-until (length= (frame-list) 2)) | ||
| 147 | (should (eq (process-status emacsclient) 'run)) | ||
| 148 | |||
| 149 | ;; Don't delete the terminal for the client; that would | ||
| 150 | ;; kill its frame immediately too. (This is only an issue | ||
| 151 | ;; when running these tests via the command line; | ||
| 152 | ;; normally, in an interactive session, we don't need to | ||
| 153 | ;; worry about this. But since we want to check that | ||
| 154 | ;; `server-force-stop' doesn't delete frames under normal | ||
| 155 | ;; circumstances, we need to bypass terminal deletion | ||
| 156 | ;; here.) | ||
| 157 | (setq terminal (process-get (car server-clients) 'terminal)) | ||
| 158 | (process-put (car server-clients) 'no-delete-terminal t) | ||
| 159 | |||
| 160 | (server-force-stop)) | ||
| 161 | ;; Ensure we didn't delete the frame. | ||
| 162 | (should (length= (frame-list) 2))) | ||
| 163 | ;; Clean up after ourselves and delete the terminal. | ||
| 164 | (when (and terminal | ||
| 165 | (eq (terminal-live-p terminal) t) | ||
| 166 | (not (eq system-type 'windows-nt))) | ||
| 167 | (delete-terminal terminal))))) | ||
| 168 | |||
| 134 | ;;; server-tests.el ends here | 169 | ;;; server-tests.el ends here |