guestfish: diagnose stdout write failure
[libguestfs.git] / fish / fish.c
index 156147a..a758810 100644 (file)
@@ -40,6 +40,7 @@
 #include <guestfs.h>
 
 #include "fish.h"
 #include <guestfs.h>
 
 #include "fish.h"
+#include "closeout.h"
 #include "progname.h"
 
 struct mp {
 #include "progname.h"
 
 struct mp {
@@ -140,6 +141,8 @@ main (int argc, char *argv[])
   /* Set global program name that is not polluted with libtool artifacts.  */
   set_program_name (argv[0]);
 
   /* Set global program name that is not polluted with libtool artifacts.  */
   set_program_name (argv[0]);
 
+  atexit (close_stdout);
+
   enum { HELP_OPTION = CHAR_MAX + 1 };
 
   static const char *options = "a:Df:h::im:nrv?Vx";
   enum { HELP_OPTION = CHAR_MAX + 1 };
 
   static const char *options = "a:Df:h::im:nrv?Vx";