[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master 9fc3b00373: Improve `restart-emacs' error reporting
From: |
Lars Ingebrigtsen |
Subject: |
master 9fc3b00373: Improve `restart-emacs' error reporting |
Date: |
Mon, 18 Apr 2022 05:03:10 -0400 (EDT) |
branch: master
commit 9fc3b003730b90d88af11a31ea55c38fd733503b
Author: Lars Ingebrigtsen <larsi@gnus.org>
Commit: Lars Ingebrigtsen <larsi@gnus.org>
Improve `restart-emacs' error reporting
* src/emacs.c (Fkill_emacs): Do better error reporting on restarting.
---
src/emacs.c | 20 ++++++++++++++++----
1 file changed, 16 insertions(+), 4 deletions(-)
diff --git a/src/emacs.c b/src/emacs.c
index 6ef19561e0..e65ed125b9 100644
--- a/src/emacs.c
+++ b/src/emacs.c
@@ -2770,6 +2770,22 @@ killed. */
{
int exit_code;
+#ifndef WINDOWSNT
+ /* Do some checking before shutting down Emacs, because errors
+ can't be meaningfully reported afterwards. */
+ if (!NILP (restart))
+ {
+ /* This is very unlikely, but it's possible to execute a binary
+ (on some systems) with no argv. */
+ if (initial_argc < 1)
+ error ("No command line arguments known; unable to re-execute Emacs");
+
+ /* Check that the binary hasn't gone away. */
+ if (!file_access_p (initial_argv[0], F_OK))
+ error ("Emacs executable \"%s\" can't be found", initial_argv[0]);
+ }
+#endif
+
#ifdef HAVE_LIBSYSTEMD
/* Notify systemd we are shutting down, but only if we have notified
it about startup. */
@@ -2815,10 +2831,6 @@ killed. */
if (!NILP (restart))
{
- /* This is very unlikely, but it's possible to execute a binary
- (on some systems) with no argv. */
- if (initial_argc < 1)
- emacs_perror ("No command line arguments known; unable to re-execute
Emacs");
#ifdef WINDOWSNT
if (w32_reexec_emacs (initial_cmdline, initial_wd) < 0)
#else
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- master 9fc3b00373: Improve `restart-emacs' error reporting,
Lars Ingebrigtsen <=