]> git.eshelyaron.com Git - emacs.git/commitdiff
* src/emacs.c (Fkill_emacs): In noninteractive mode exit
authorAndreas Schwab <schwab@linux-m68k.org>
Fri, 23 Sep 2011 09:56:55 +0000 (11:56 +0200)
committerAndreas Schwab <schwab@linux-m68k.org>
Fri, 23 Sep 2011 09:56:55 +0000 (11:56 +0200)
non-successfully if a write error occurred on stdout.  (Bug#9574)

src/ChangeLog
src/emacs.c

index dff41f1dbbfc06d1d248da5bae9f57cb7527144c..44a76068313ad2129dab1b4fde506b56b94889c2 100644 (file)
@@ -1,3 +1,8 @@
+2011-09-23  Andreas Schwab  <schwab@linux-m68k.org>
+
+       * emacs.c (Fkill_emacs): In noninteractive mode exit
+       non-successfully if a write error occurred on stdout.  (Bug#9574)
+
 2011-09-21  Eli Zaretskii  <eliz@gnu.org>
 
        * xdisp.c (pop_it): Allow it->object that is a cons cell to pass
index 321e7919c9332565233f20177162bc2ac1c0fd2a..0a684d4423c395727039ac2c33c6129f9494d057 100644 (file)
@@ -1993,6 +1993,7 @@ all of which are called before Emacs is actually killed.  */)
 {
   struct gcpro gcpro1;
   Lisp_Object hook;
+  int exit_code;
 
   GCPRO1 (arg);
 
@@ -2017,7 +2018,10 @@ all of which are called before Emacs is actually killed.  */)
   if (STRINGP (Vauto_save_list_file_name))
     unlink (SSDATA (Vauto_save_list_file_name));
 
-  exit (INTEGERP (arg) ? XINT (arg) : EXIT_SUCCESS);
+  exit_code = EXIT_SUCCESS;
+  if (noninteractive && fflush (stdout))
+    exit_code = EXIT_FAILURE;
+  exit (INTEGERP (arg) ? XINT (arg) : exit_code);
 }