• Paul Eggert's avatar
    Fix data-loss with --batch. · 7ccfb720
    Paul Eggert authored
    * admin/merge-gnulib (GNULIB_MODULES): Add close-stream.
    * lib/close-stream.c, lib/close-stream.h, lib/fpending.c
    * lib/fpending.h, m4/close-stream.m4, m4/fpending.m4:
    New files, from gnulib.
    * lib/gnulib.mk, m4/gnulib-comp.m4: Regenerate.
    * src/emacs.c: Include <close-stream.h>.
    (close_output_streams): New function.
    (main): Pass it to atexit, so that Emacs closes stdout and stderr
    and handles errors appropriately.
    (Fkill_emacs): Don't worry about flushing, as close_output_stream
    does that now.
    
    Fixes: debbugs:9574
    7ccfb720
close-stream.h 52 Bytes