|
From: | Paul Eggert |
Subject: | Re: `message' not outputting the newline "atomically" |
Date: | Tue, 9 Jul 2019 11:12:52 -0700 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.7.2 |
Eli Zaretskii wrote:
We already found an agreed solution for 'message' and 'vmessage', so why step back and re-introduce them into the problem again?
Because we now have a simpler solution.
As for other messages, I think the vast majority are diagnostics, and thus using stdout for them is inappropriate, as it will get in the way of using Emacs in scripts.
No, Emacs uses stdout reasonably extensively for this sort of thing already; see 'write_stdout' and I can cite several other examples. In practice this has not been a problem because nobody cares whether these kinds of Emacs messages go to stdout or stderr. One can also see this in the decades-old commentary for the implementation of 'message', which says both 'stdout' and 'stderr' (obviously some of this commentary is incorrect, and the proposed patch fixes it).
All I'm suggesting is that we move a few messages from Emacs's stderr category to its (already-existing) stdout category, to fix the interleaving problem for messages that are not fatal diagnostics or for debugging. These messages are the ones most likely to cause interleaving problems in practice. The vast majority of messages would be unaffected by the proposed patch.
what would happen if a script says 2>foo? will the file 'foo' remain empty if we use any stream but stderr inside message_to_stderr?
No, it'll work fine. The OS doesn't care about stdio's buffers; all it cares is whether file descriptor 2 is used, which it is.
[Prev in Thread] | Current Thread | [Next in Thread] |