bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#12908: 24.3.50; file `emacs_backtrace.txt'?


From: Paul Eggert
Subject: bug#12908: 24.3.50; file `emacs_backtrace.txt'?
Date: Sat, 17 Nov 2012 13:25:17 -0800
User-agent: Mozilla/5.0 (X11; Linux i686; rv:16.0) Gecko/20121028 Thunderbird/16.0.2

On 11/17/2012 11:42 AM, Eli Zaretskii wrote:

> Unless we are going to ask each Emacs user to change the default so
> that the file ends up in .emacs.d, we still have a discrepancy vs what
> Stefan asked to do.

I must have missed that request; all I see from him in Bug#12908
is a comment about how to deal with the file names under the
assumption that Emacs itself redirects stderr to a file
whose name Emacs chooses.  That assumption is currently true on
Microsoft Windows for backtraces, but it's not true for GNU and Unix
where we don't have the problem.

>> Perhaps it would be better for Emacs, on Microsoft Windows, to
>> redirect stderr to a file, so that the information does not get
>> lost.
> 
> It's not easy to do that

Can Emacs use freopen?  For example, the
following code would do the job on a POSIX platform:
if stderr is closed, it redirects it to emacs-stderr.txt
in the current directory, if possible.  Would this sort of thing
work on Microsoft platform?

=== modified file 'src/emacs.c'
--- src/emacs.c 2012-11-08 19:12:23 +0000
+++ src/emacs.c 2012-11-17 21:23:46 +0000
@@ -748,6 +748,11 @@ main (int argc, char **argv)
     unexec_init_emacs_zone ();
 #endif
 
+#ifdef DOS_NT
+  if (dup2 (STDERR_FILENO, STDERR_FILENO) < 0)
+    ignore_value (freopen ("emacs-stderr.txt", "a", stderr));
+#endif
+
   atexit (close_output_streams);
 
   sort_args (argc, argv);






reply via email to

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