emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: `message' not outputting the newline "atomically"


From: Lars Ingebrigtsen
Subject: Re: `message' not outputting the newline "atomically"
Date: Mon, 24 Jun 2019 21:48:11 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

So...  does this look OK?

diff --git a/src/xdisp.c b/src/xdisp.c
index 5d70440f1c..0b45ca9e02 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -10705,10 +10705,22 @@ message_to_stderr (Lisp_Object m)
       else
        s = m;
 
-      fwrite (SDATA (s), SBYTES (s), 1, stderr);
+      /* We want to write this out with a single fwrite call so that
+        output doesn't interleave with other processes writing to
+        stderr at the same time. */
+      {
+       int length = SBYTES (s);
+       char *string = xmalloc (length + 1);
+       
+       memcpy (string, SSDATA (s), length);
+       *(string + length) = '\n';
+       fwrite (string, length + 1, 1, stderr);
+       xfree (string);
+      }
     }
-  if (!cursor_in_echo_area)
+  else if (!cursor_in_echo_area)
     fputc ('\n', stderr);
+
   fflush (stderr);
 }
 


-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




reply via email to

[Prev in Thread] Current Thread [Next in Thread]